Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 1
Trades: 0
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
 
 
Register now for full access!
Old 04-27-2006, 03:51 PM Re: Firefox scripting problem...
Junior Talker

Posts: 3
Location: Lancaster, PA
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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 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.11816 seconds with 12 queries