| | |
Form Problem
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have a single form in my web page. The Form is defined as
In a javascript function, when I am writing
document.Form1.txt1.value = 5 ;
I am getting an error "document.Form1.txt1 is invalid or null".
Instead if I write
document.forms[0].txt1.value = 5 ;
it is working fine. What is wrong with the first statement ? I am using Visual Interdev 6, in which the dropdown list that appears for a object method/properties, is showing Form1 as a property of document and txt1 as a property of Form1 when I press dot(.) after the object name.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<FORM action="somepage.asp" method="post" id="Form1" > <INPUT TYPE="Text" Name="txt1" id="txt1" size=5 > </FORM>
In a javascript function, when I am writing
document.Form1.txt1.value = 5 ;
I am getting an error "document.Form1.txt1 is invalid or null".
Instead if I write
document.forms[0].txt1.value = 5 ;
it is working fine. What is wrong with the first statement ? I am using Visual Interdev 6, in which the dropdown list that appears for a object method/properties, is showing Form1 as a property of document and txt1 as a property of Form1 when I press dot(.) after the object name.
![]() |
Similar Threads
- I have a form problem (HTML and CSS)
- Not sending Feedback Form (PHP)
- Form Fields (JavaScript / DHTML / AJAX)
- email form problem (Web Hosting Deals)
- asp form problem (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: opera problems with hover menu
- Next Thread: Is my code wrong or is Opera?
Views: 1282 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets array autoplay blackjack browser captcha captchaformproblem cart child class close codes date debugger dependent developer disablefirebug dom editor element embed engine enter events explorer ext file firefox flash form forms frameworks game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe java javascript javascripthelp2020 jquery jsf jsp jump libcurl maps margin marquee masterpage math media menu object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming prototype rated redirect safari scale scriptlets scroll search security size software solutions sources star stars stretch synchronous toggle tweet unicode variables web webkit webservice window \n






