Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: document.getElementById(cis) has no properties

  1. #1
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default document.getElementById(cis) has no properties

    DD Tab Menu II
    http://dynamicdrive.com/dynamicindex1/ddtabmenu2.htm

    I am getting an error running on the script listed above. The error I'm getting is saying:

    document.getElementById(cis) has no properties

    Here is the code related to this error. Italicized is the only part of this code that refers to 'cis'. I did place the second portion of the code as well, but there is also no mention of 'cis' there either. I thought at first this had to do with a tag needing to have an id of cis but I really have no idea why this error keeps popping up. Any help would be much appreciated.

    Thanks guys.

    <script type="text/javascript">
    /***********************************************
    * DD Tab Menu II script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    //Set tab to intially be selected when page loads:
    //[which tab (1=first tab), ID of tab content to display]:
    var initialtab=[1, "sc1"]
    //Turn menu into single level image tabs (completely hides 2nd level)?
    var turntosingle=0 //0 for no (default), 1 for yes
    //Disable hyperlinks in 1st level tab images?
    var disabletablinks=1 //0 for no (default), 1 for yes
    var previoustab=""

    function expandcontent(cid, aobject){
    if (disabletablinks==1)
    aobject.onclick=new Function("return false")
    if (document.getElementById && turntosingle==0){
    highlighttab(aobject)
    if (previoustab!="")
    document.getElementById(previoustab).style.display="none"
    document.getElementById(cid).style.display="block"
    previoustab=cid
    }
    }



    function highlighttab(aobject){
    if (typeof tabobjlinks=="undefined")
    collectddimagetabs()
    for (i=0; i<tabobjlinks.length; i++)
    tabobjlinks[i].className=""
    aobject.className="current"
    }
    function collecttabs(){
    var tabobj=document.getElementById("tabs")
    tabobjlinks=tabobj.getElementsByTagName("A")
    }
    function do_onload(){
    collecttabs()
    expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
    }
    if (window.addEventListener)
    window.addEventListener("load", do_onload, false)
    else if (window.attachEvent)
    window.attachEvent("onload", do_onload)
    else if (document.getElementById)
    window.onload=do_onload
    </script>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No mention of "cis" there. It's "cid."
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In reply to the...

    No mention of "cis" there. It's "cid."

    Yes, I'm a moron...I meant the error is:

    document.getElementById(cid) has no properties

    Anywhere I mentioned cis replace with cid.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, OK. What does the tag look like where you use expandcontent()?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In the javascript...



    function expandcontent(cid, aobject){
    if (disabletablinks==1)
    aobject.onclick=new Function("return false")
    if (document.getElementById && turntosingle==0){
    highlighttab(aobject)
    if (previoustab!="")
    document.getElementById(previoustab).style.display="none"
    document.getElementById(cid).style.display="block"
    previoustab=cid
    }
    }



    In the HTML...



    <a href="#" onMouseover="expandcontent('LINK1', this)">Link1</a> | <a href="#" onMouseover="expandcontent('LINK2', this)">Link2</a> | <a href="#" onMouseover="expandcontent('LINK3', this)">Link3</a> | <a href="http://url/" onMouseover="expandcontent('LINK4', this)">Link4</a> | <a href="" onMouseover="expandcontent('LINK5', this)">Link5</a>
    </div>
    <div id="Navcontainer">
    <div id="LINK1" class="tabcontent">
    <a href="#" target="_self" id="cid">SubLink1</a> | <a href="#" target="_self" >SubLink2</a> | <a href="#" target="_self" >SubLink3</a>
    </div>
    <div id="LINK2" class="tabcontent">
    <a href="#" target="_self" >SubLink4</a> | <a href="#" target="_self" >SubLink5</a> | <a href="#" target="_self" >SubLink6</a>
    </div>
    <div id="LINK3" class="tabcontent">
    <a href="#" target="_self" >SubLink7</a> | <a href="#" target="_self" >SubLink8</a> | <a href="#" target="_self" >SubLink9</a>
    </div>
    <div id="LINK4" class="tabcontent">
    <a href="#" target="_self" >SubLink10</a> | <a href="#" target="_self" >SubLink11</a> | <a href="#" target="_self" >SubLink12</a>
    </div>
    <div id="LINK5" class="tabcontent">
    <a href="#" target="_self" >SubLink13</a> | <a href="#" target="_self" >SubLink14</a> | <a href="#" target="_self" >SubLink15</a>

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Is that last div ever closed?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, the last div is closed. The thing I find hard to figure out is what 'cid' is for. I don't show it listed as any id anywhere. If I knew what part of the code the cid was for I would at least know where to look for the error.

    This bold line is the specific line that is giving the error in the browser.

    function expandcontent(cid, aobject){
    if (disabletablinks==1)
    aobject.onclick=new Function("return false")
    if (document.getElementById && turntosingle==0){
    highlighttab(aobject)
    if (previoustab!="")
    document.getElementById(previoustab).style.display="none"
    document.getElementById(cid).style.display="block"
    previoustab=cid
    }
    }

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The part of the code you have there is the only part that has access to cid, for a start, as it's a function argument. The place to look for the error is in your HTML, as you've pasted it above. The first argument you're passing to expandcontent() (at some point) isn't valid. Do you have a line/character reference, or could you provide a link to the page in question?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Nov 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    http://homepages.wmich.edu/~j2willi4/schoolcraft

    That is a link to the page that has the error. I did figure it had to do with the HTML in reference to an id that would have been cid, but since that is not the problem, that's why I'm having the issue.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Aha.
    The problematic ID is here:
    Code:
    //Set tab to intially be selected when page loads:
    //[which tab (1=first tab), ID of tab content to display]:
    var initialtab=[1, "sc1"]
    Element with ID "sc1" obviously doesn't exist. If you don't want a tab to open initially, simply find and remove the following line:
    Code:
    expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
    It's in do_onload().
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •