document.getElementById("tabs") has no properties

This is a discussion on "document.getElementById("tabs") has no properties" within the JavaScript Forum section. This forum, and the thread "document.getElementById("tabs") has no properties are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 7th, 2007, 13:59
Junior Member
Join Date: Jan 2007
Location: South Cambs, UK
Age: 18
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
document.getElementById("tabs") has no properties

Hi, I am trying to learn how to make a tab system for a website I have this javascript so far
Code: Select all
var tabs = [['News', 'This Is The News Tab'], ['Events', 'This Is The Events Tab'], ['Other', 'This Is The Other Tab']];

function draw_tabs()
{
    var length = tabs.length;
    var html = null;
    
    for(var i = 0; i < length; i ++) {
        html += "<span id=\"" + tabs[i][0] + "\" onclick=\"select_tab(" + i + ")\">" + tabs[i][0] + "</span>";
    }
    
    document.getElementById("tabs").innerHTML = html;
}

draw_tabs();
I also have the firefox extension Web Developer and it gives the error document.getElementById("tabs") has no properties

My html is this
Code: Select all
<div class="tabs" id="tabs">&nbsp;</div>
<div id="tab_content">&nbsp;</div>
Any idea why I get this error? It works fine in my other apps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 7th, 2007, 16:47
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById("tabs") has no properties

Where abouts on the page do you have the javascript? You would need to be including the function call after the HTML you have given or else it won't be found as it doesn't exist in the document at that point.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 7th, 2007, 18:51
Junior Member
Join Date: Jan 2007
Location: South Cambs, UK
Age: 18
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById("tabs") has no properties

Haha. Oh God, of course!
Oops
Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 7th, 2007, 19:11
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById("tabs") has no properties

LOL - common mistake I've tried desperately to put the clumps of hair back in after realising I've made this error.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
java, script

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a "tag" system to find relevant "related" pages MrQuestions PHP Forum 3 Mar 20th, 2008 23:06
[SOLVED] Show "Image" Depends On User "Status"? Monie Classic ASP 6 Oct 16th, 2007 01:22
? IS "meta name="robots" content="?" necessary in pages ? Love2Java Starting Out 6 Aug 8th, 2007 13:48
document.getElementById("userProfileCheck") is not working in Mozilla Firefox dhineraj JavaScript Forum 1 Jul 20th, 2007 05:32
window.opener.document["nameForm"].getElementById("someid").value; doesnt work drpompeii JavaScript Forum 0 Feb 17th, 2007 23:09


All times are GMT. The time now is 10:11.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42