473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

i want get the value in dynamic from script

<html>
<script language="text/javascript">
var test=DValue;
</script>
<body>
<inpu type="text" name="name" value="<script>test</script>" />
</body>
</html>

i want get the test "DValue" in dynamic.
test value will be changed dynamically...
Jun 22 '07 #1
2 1244
You can achieve it by doing like this


<html>
<script language="text/javascript">
var test=DValue;
document.myForm.name.value=test;
</script>
<body>
<form name="myForm">
<inpu type="text" name="name"/>
</form>
</body>
</html>
Jun 22 '07 #2
gits
5,390 Expert Mod 4TB
You can achieve it by doing like this


<html>
<script language="text/javascript">
var test=DValue;
document.myForm.name.value=test;
</script>
<body>
<form name="myForm">
<inpu type="text" name="name"/>
</form>
</body>
</html>
hi ... we have to correct some things here:

[HTML]
<html>

<script type="text/javascript">
function set_field() {
var test = 'DValue';
document.myForm.name.value = test;
}
</script>

<body onload="set_field();">

<form name="myForm">
<input type="text" name="name"/>
</form>

</body>

</html>[/HTML]

explaination: its the script-type to set, and we have to wrap the code in a function that we call onload of the body, until the textbox has to be loaded and rendered first by the browser. the way you want to do it ... means the script is executed during load ... before the document is ready to use ... so we wait for it and then call the set_field() method ... try it if you're wondering why it is not working. and DValue would be a variable in your code ... that is undefined here and the script will stop with an error for this ... so use a stringvalue here or declare the variable ... and assign a value to it ...

kind regards ...
Jun 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Arjen | last post by:
IE 6 does not return the value of a dynamic option list. Mozilla performs fine. How can I get the value of a choice in IE? Simple example below. Option list is filled with first element of array...
1
by: SAN CAZIANO | last post by:
I have create a dynamic html table by adding some rows where I have to put some value in an input field and now how can I get all value of all row ??? I try this but it doesn' work button...
10
by: Iain | last post by:
Hi All My apologies if this appears to be simple to some of you but I have very little experience of javascript and I cannot work this one out, The code below is a nice piece of code I found...
2
by: dawg1998 | last post by:
I have a page that creates dynamic textboxes based on the number of fields a user chooses to fill out. This process worked great when the page was standalone. However, when I move to a...
4
by: lisabelle | last post by:
Really, all I've ever done is a little html, but since FrontPage, hardly any. Now I am ready to sell my products after being online for a decade. I am newly signed up with Link Partners, and I get an...
13
by: HockeyFan | last post by:
I'm not sure how to exactly ask this, but expect that it's a Javascript solution. However, I'll ask the question and maybe someone can point me to some existing code that will do what I need. I...
1
by: empiresolutions | last post by:
Hello fellow code junkies, I am using the "Ajax dynamic list" http://dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-list and i think its the best out there. I have found a compatibility...
6
by: empiresolutions | last post by:
I have a textfield that uses a dynamic dropdown select script to let me choose a country by a few letters. Example, keying "B" shows "Brazil, Bulgaria, Belarus... Once i choose a county another...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.