Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 20th, 2006, 10:35 PM
Authorized User
Join Date: Jul 2003
Location: , , .
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to modify hidden value?

I have a HTML file,there are hidden parameter in in this HTML,hidden parameter name is made of "test"+number,such as
<form name="test" id="test">
 <input type="hidden" name="test0" value="9">
 <input type="hidden" name="test1" value="5">
 <input type="hidden" name="test2" value="6">
 <input type="hidden" name="test3" value="1">

I want to dynamic modify the hidden value,for example
i=3 //the value of i is get dynamic,i=2 or i=3 or any number
I know above sentence is error,how to write it correctly?


Reply With Quote
  #2 (permalink)  
Old January 21st, 2006, 01:18 AM
Friend of Wrox
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919

Hii Edward King!!


eval("document.formname.textboxname"+i).value=new_ value
in ur case
function setHiddenValue(obj)
<form name="test" id="test">
 <input type="text" name="test0" value="9">
 <input type="text" name="test1" value="5">
 <input type="text" name="test2" value="6">
 <input type="text" name="test3" value="1">
<select name="val" onchange="setHiddenValue(this)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>

Change type=text to hidden in ur code
hope this will help you

Cheers :)

Reply With Quote
  #3 (permalink)  
Old January 21st, 2006, 05:44 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

In my opinion anyone who uses "eval" for a task like this should be drummed out of the programmers guild.
function setElementValue(FormName, ElementName, Value)
  document.forms[FormName].elements[ElementName].value = Value;
setElementValue("test", "test" + 3, 99);


Joe (Microsoft MVP - XML)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to modify the shopping ssomchai BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 3rd, 2008 01:52 AM
Help Modify GetThreadsRss kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 22nd, 2008 12:14 PM
Modify XSLT mikeymikey XSLT 4 January 5th, 2008 11:21 PM
How to modify "for-each" to "last occurrence of" ? nyctechwriter XSLT 3 October 30th, 2006 01:15 PM

All times are GMT -4. The time now is 07:52 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.