document.getElementById and document.getElementByName is not working in FF

This is a discussion on "document.getElementById and document.getElementByName is not working in FF" within the JavaScript Forum section. This forum, and the thread "document.getElementById and document.getElementByName is not working in FF 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 21st, 2007, 07:22
New Member
Join Date: Jul 2007
Location: Chennai,India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
document.getElementById and document.getElementByName is not working in FF

Hi every body,

document.getElementById and document.getElementByName is not working in FF

this my code:
<HTML>
<script>
function Foo(){


// if(document.getElementById('button'))
if(document.getElementByName('button')) { alert('gi');
document.myform.button.disabled = true;}

}

function check(){
if(document.myform.Lee.checked)
document.myform.button.disabled = true;
else
document.myform.button.disabled = false;
}

</script>

<BODY>
<br><br><br><br><br>

<form name='myform'>
<table cellspacing="0" cellpadding="0" width="100" align="center">

<tr align="left" valign="top" ><td>User Name :
<input type = "text" size=25>
</td>

</tr>

<tr align="left" valign="top" ><td>Passowrd :
<input type = "password" size=25>
</td>
</tr>

<tr align="left" valign="top" >

<td align=right><input type = "checkbox" size=35 name="Lee" onclick='check()'>
Remember my username </td>
</tr>

<tr align="left" valign="top" >

<td align="center"><input type="button" onclick="Foo()" name='button' value="Login"></td>
</tr>

</table></form>
</BODY>
</HTML>

Any one help me how to solve this problem..
Reply With Quote

  #2 (permalink)  
Old Jul 21st, 2007, 11:21
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 and document.getElementByName is not working in FF

try changing the names to ids, that should help, i didn't know there was a getElementByName() function...
Reply With Quote
  #3 (permalink)  
Old Jul 22nd, 2007, 03:32
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById and document.getElementByName is not working in FF

Yeah, name and ID are different. You must add the ID attribute.
Reply With Quote
  #4 (permalink)  
Old Jul 26th, 2007, 20:23
Junior Member
Join Date: Jul 2007
Location: West Midlands
Age: 26
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Re: document.getElementById and document.getElementByName is not working in FF

Personally I dont like name, ID should always be unique so I tend to stick with that, as for why it isn't working

Code: Select all
<input type="button" onclick="Foo()" name='button' value="Login">
Simple there you have the name but not the id

Code: Select all
<input type="button" onclick="Foo()" name='button' value="Login" id="button">
that is how the syntax should look
Reply With Quote
Reply

Tags
getelementbyid, getelementbyname

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("userProfileCheck") is not working in Mozilla Firefox dhineraj JavaScript Forum 1 Jul 20th, 2007 05:32
document.getElementById is not working in Mozilla Firefox dhineraj JavaScript Forum 3 Jul 20th, 2007 02:31
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 04:38.


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