ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Purpose of this Scripting...

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming
View previous topic :: View next topic  
Author Message
bigbrain28



Joined: 16 Mar 2006
Posts: 4
Location: Spring Hil, Florida

PostPosted: Thu Mar 16, 2006 12:14 pm    Post subject: Purpose of this Scripting... Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

SQL Tutorial