document.getElementById is not working in Mozilla Firefox

This is a discussion on "document.getElementById is not working in Mozilla Firefox" within the JavaScript Forum section. This forum, and the thread "document.getElementById is not working in Mozilla Firefox are both part of the Program Your Website category.



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

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 19th, 2007, 12:43
New Member
Join Date: Jul 2007
Location: Chennai,India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
document.getElementById is not working in Mozilla Firefox

in my web application am using this following method

document.getElementById(''name") ;

this not working in Mozilla Firefox but its working fine in IE.

following errors occurs in mozila
Error: document.getElementById("name") has no properties


any one suggest me how to solve this...
Reply With Quote

  #2 (permalink)  
Old Jul 19th, 2007, 22:34
Reputable Member
Join Date: Jul 2007
Location: Windsor, ON, Canada
Age: 19
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById is not working in Mozilla Firefox

what properties are you accessing? and for some reason i'm thinking you're supposed to put the ID value in single quotes... might be wrong, but i think i've had to do that a few times.

could you put up the rest of the code? i might be able to help more
Reply With Quote
  #3 (permalink)  
Old Jul 19th, 2007, 23:27
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById is not working in Mozilla Firefox

Yeah post up your full code and the html if you can. That would be helpful.

Pete.
Reply With Quote
  #4 (permalink)  
Old Jul 20th, 2007, 02:31
Junior Member
Join Date: Jul 2007
Location: Sydney
Age: 26
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById is not working in Mozilla Firefox

I thought it may have been the double quotes. However I tested it and it seems to work fine either way. The following code worked for me in IE6 and FF.

Code: Select all
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
    function changeColor() { 
    en = document.getElementById("name");
    en.style.background = '#333333';
    }
</script>
<title>Untitled Document</title>
</head>

<body>
<div id="name" style="width:100px; height:100px; background:#009933;"></div>
<a href="javascript:changeColor();">Change Color</a>
</body>
Reply With Quote
Reply

Tags
getelementbyid, is not working

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
Help using document.getElementById jonnymorris JavaScript Forum 3 Mar 28th, 2008 22:52
document.getElementById and document.getElementByName is not working in FF dhineraj JavaScript Forum 3 Jul 26th, 2007 20:23
document.getElementById("userProfileCheck") is not working in Mozilla Firefox dhineraj JavaScript Forum 1 Jul 20th, 2007 05:32
document.getElementById[objectID].style now working on Mozilla Browser yogeshid JavaScript Forum 1 May 25th, 2007 09:30
new problem. document.getElementById().width returning unassigned. why? sanchopansa JavaScript Forum 2 Jul 22nd, 2006 20:23


All times are GMT. The time now is 00:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs 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 43