HTML Help
HTML Help Central . com

» Online Users: 58

0 members and 58 guests
No Members online
Most users ever online was 695, 02-16-2011 at 07:01 AM.

» Site Navigation

 > FAQ

» Domains For Sale

Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Posts
    2

    Unhappy setting hidden form value via javascript

    This is a a very basic question I am sure. I have a form that has multiple hidden form fields. One of these fields needs to be set to the page title. This form exists in multiple states on multiple pages. I would like to set this form value dynamically via javascript. Could anyone help me out with this one? I am very new to javascript and having a rough time wrapping my head around this one, I know I need to use document.title, but that is about it. Thanks in advance for any help.

    daryl

  2. #2
    Join Date
    Oct 2002
    Location
    Houston, Texas
    Posts
    1,994
    Code:
    <html>
     <head>
      <title>Original Title</title>
      <script language="JavaScript">
       <!--
        function do_it() {
         document.title=document.forms[0].page_title.value;
        }
       // --->
      </script>
     </head>
     <body>
      <form name="the_form">
       <input type="hidden" name="page_title" value="This is the New Page Title">
       <input type="button" value="Click Me" onClick="do_it()">
      </form>
     </body>
    </html>
    </html>
    This shows you how to get the value from the hidden input to javascript and how to set that value to the document title.

    This method uses a button to activate the function, however there are many ways to activate it...

    Hope this is what you wanted to know.
    -Billy

    "I am using Linux every day to up my productivity - so up yours!"

    ******** W A R N I N G ! *******************************
    Linux should not be used by those under the influence of Microsoft.
    May cause dizziness or vertigo. Consult your tech support before
    using Linux. (note--after using Linux, you may notice extreme
    discomfort when using Microsoft. Discontinue use of Microsoft.)
    ******************************* W A R N I N G ! ********

  3. #3
    Join Date
    Aug 2005
    Posts
    2
    perfect, Thanks!!!

  4. #4
    Join Date
    Oct 2002
    Location
    Houston, Texas
    Posts
    1,994
    Glad I could help
    -Billy

    "I am using Linux every day to up my productivity - so up yours!"

    ******** W A R N I N G ! *******************************
    Linux should not be used by those under the influence of Microsoft.
    May cause dizziness or vertigo. Consult your tech support before
    using Linux. (note--after using Linux, you may notice extreme
    discomfort when using Microsoft. Discontinue use of Microsoft.)
    ******************************* W A R N I N G ! ********

Similar Threads

  1. JavaScript form help
    By Pfern in forum Javascript / AJAX / VBScript
    Replies: 7
    Last Post: 06-26-2006, 03:50 PM
  2. setting focus on a form field
    By langals in forum Javascript / AJAX / VBScript
    Replies: 3
    Last Post: 08-05-2003, 11:46 AM
  3. setting the values in a hidden field by appending a counter onto a field name
    By maherphil in forum Javascript / AJAX / VBScript
    Replies: 1
    Last Post: 12-15-2002, 05:15 AM
  4. Lead Tracking Form hidden value problem
    By fgnbry in forum HTML / XHTML / XML
    Replies: 1
    Last Post: 12-10-2002, 12:52 AM
  5. Adding Javascript to a Form
    By cybervugs in forum Javascript / AJAX / VBScript
    Replies: 3
    Last Post: 05-30-2001, 10:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1