View previous topic :: View next topic |
Author |
Message |
bigbrain28
Joined: 16 Mar 2006 Posts: 4 Location: Spring Hil, Florida
|
Posted: Thu Mar 16, 2006 12:14 pm Post subject: Purpose of this Scripting... |
|
|
Could someone verify for me, does this scripting appear to be a function for replacing/updating the values of hidden form elements? And if so should that function execute on call, or only after a submit/reload?
Code: |
// locate element by ID
function locateElement(name) {
var element;
// locate element in a manner compatible to all browsers
if (document.getElementById)
element = document.getElementById(name);
else if (document.all)
element = document.all[name];
else if (document.layers) {
for (var i = 0; i < document.forms[0].length; i++) {
if (document.forms[0].elements[i].name == name) {
element = document.forms[0].elements[i];
break;
}
}
}
return element;
}
// modify value of hidden input
function modifyHidden(name, value) {
// locate hidden
var hidden = locateElement(name);
if (hidden == null)
return null;
// modify its value
hidden.value = value;
}
// obtain value of hidden input
function obtainHidden(name) {
// locate hidden
var hidden = locateElement(name);
if (hidden == null)
return null;
// obtain its value
return hidden.value;
}
// reload page
function reload() {
document.forms[0].submit();
} |
...and the last bit ( "reload()" ) I assume any call to that function should submit the first form on the page? And what would I alter if I wanted to target another form, the [0]?
This question is relative to my last question about updating values in a form prior to submittal.
Thanks so much for any help! _________________ Beware the n00b...Hey, thats me! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|