Reply
Firefox scripting problem...
Old 04-26-2006, 05:10 PM Firefox scripting problem...
CDH
Junior Talker

Posts: 1
I'm using Javascript to dynamically create a form on the fly. Firefox can create the form, but when it comes to reading the values in the form i get an error saying that the object has no properties. The code works fine in IE. My guess is that Firefox doesn't know that the form was created and doesnt load their values. In the following example of the code, showForm() works fine. changePass() gives me "newpass has no properties". What do I do?

function showForm(){
getArea = document.getElementById("areatoputform");
getArea.innerHTML = "Old Pass:<input type='password' size='10 id='oldpass' name='oldpass' class='oldpass' /><br>New Pass:<input type='password' size='10 id='newpass' name='newpass' class='newpass' /><br>Confirm: <input type='password' size='10 id='confirm' name='confirm' class='confirm' /><input type='button' name='btnchgpass' value='Change' onClick='changepass();' />"
}

function changepass(){
var oldpass = document.getElementById('oldpass'); //pane where server replies gets placed
var newpass = document.getElementById('newpass'); //pane where server replies gets placed
var confirm = document.getElementById('confirm'); //pane where server replies gets placed

if (newpass.value==confirm.value){...}

}
CDH is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-27-2006, 02:51 PM Re: Firefox scripting problem...
Junior Talker

Posts: 3
Location: Lancaster, PA
Quote:
Originally Posted by CDH
I'm using Javascript to dynamically create a form on the fly. Firefox can create the form, but when it comes to reading the values in the form i get an error saying that the object has no properties. The code works fine in IE. My guess is that Firefox doesn't know that the form was created and doesnt load their values. In the following example of the code, showForm() works fine. changePass() gives me "newpass has no properties". What do I do?
I'm not 100% sure of the problem either, but here the old-fashioned approach works, so Firefox is seeing the <input> tags.

var oldpass = document.forms[0].elements['oldpass'];

works fine, assuming you have a pair of <form> tags in your code.

I'm using Firefox 1.5.0.1. It's probably something silly we're both missing.

Todd
theTAO is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Firefox scripting problem...
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10858 seconds with 13 queries