•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 392,072 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,175 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 6228 | Replies: 14
![]() |
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,164
Reputation:
Rep Power: 7
Solved Threads: 58
[HTML]<script type="text/javascript">
var theText = document.forms[0]["txtFieldName"].value;
</script>[/HTML]
That's how to reference a control in an HTML form, but after you submit? I don't get it. More info required.
var theText = document.forms[0]["txtFieldName"].value;
</script>[/HTML]
That's how to reference a control in an HTML form, but after you submit? I don't get it. More info required.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,164
Reputation:
Rep Power: 7
Solved Threads: 58
That won't work with square brackets, but with parentheses that is fine.
Both our methods are the best cross browser methods. As long as you avoid document.all or document.txtFieldName you should be ok.
Well Covinus said:
And I'm trying to think of why would you want to reference a control in client side script after a submit? perhaps the submit is irrelevant in this case and a red herring just to keep us on our toes!
Both our methods are the best cross browser methods. As long as you avoid document.all or document.txtFieldName you should be ok.
•
•
•
•
I'm not sure what you're hinting at by "after the submit", though, in your question.
Well Covinus said:
•
•
•
•
how do I get The value I have entered in a textfield after submitting
And I'm trying to think of why would you want to reference a control in client side script after a submit? perhaps the submit is irrelevant in this case and a red herring just to keep us on our toes!
Last edited by hollystyles : Aug 1st, 2006 at 11:24 am.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,164
Reputation:
Rep Power: 7
Solved Threads: 58
•
•
•
•
do you really need the semicolon in last line??? i found books that dont have ; in the end
It is true some browsers will run javascript without ; line terminators. But it is bad practice because the ECMA standard states ; is required and browser implimentations could change in the future. So any script you write without them, may work now but could be rendered useless after a browser upgrade.
I would say if you have books that omit ; they are out-of-date or just poor. If you can get hold of it in the Philippines I recommend the Javascript Anthology by James Edwards and Cameron Adams published by Sitepoint ISBN 0-9752402-6-9
Last edited by hollystyles : Aug 2nd, 2006 at 4:09 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
- Searching a Text Field in a JList (Java)
- Text field does not enable on refresh (JavaScript / DHTML / AJAX)
- JSP and Servlet Display of text in a text field (JSP)
- Filtering My sql through Php using drop down menu and text field (PHP)
- DOB field-how to use text field and pop out calendar same time? (ASP)
- Output MySQL text field formatted (PHP)
Other Threads in the HTML and CSS Forum
- Previous Thread: table shrinking
- Next Thread: link color works in FF but not IE



Linear Mode