473,395 Members | 1,464 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,395 software developers and data experts.

Text input value equal to a variable

Is there a way to have a text input field equal some variable value so that it
changes if that variable changes? It does not have to by dynamic.

<INPUT TYPE="TEXT" NAME="hW" size="4" value=some variable>

Thanks,
Jeff
Jul 20 '05 #1
5 9903
gf
"JeffFinnan" <je********@aol.com> wrote in message
news:20***************************@mb-m15.aol.com...
Is there a way to have a text input field equal some variable value so that it changes if that variable changes? It does not have to by dynamic.

<INPUT TYPE="TEXT" NAME="hW" size="4" value=some variable>

Thanks,
Jeff

This will place the value of Field1 into Field2 as soon as Field1 loses its
focus

<form name='myform1'>
Field1: <input name='f1' onChange='document.myform1.f2.value=this.value'>
<br /><br />
Field2: <input name='f2'>
</form>

or

<form name='myform2'>
Field1: <input name='f1'>
<br /><br />
Field2: <input name='f2' onFocus='this.value=document.myform2.f1.value'>
</form>

Jul 20 '05 #2
Lee
JeffFinnan said:

Is there a way to have a text input field equal some variable value so that it
changes if that variable changes? It does not have to by dynamic.


You want it to change if the variable changes, but it doesn't have
to be dynamic? You're not being clear. What is it that you're
trying to do?

Jul 20 '05 #3
>You want it to change if the variable changes, but it doesn't have
to be dynamic? You're not being clear. What is it that you're
trying to do?


==============
I have a frame load with a default value for a parameter that is use for sizing
a plugin (Chime). I then want to have a input box show this default value but
then allow a new number to be put in so that when the frame is reloaded, the
plugin has this new value and the new value is shown in the input box. I looked
at what gf******@earthlink.net had written. I got it to do the above with

=============================
<form name=form2>
<input type=button onClick="resetFile()" value="Reset/Reload">
&nbsp;&nbsp;&nbsp; Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.value=parent.upper.heightWidth' >

</form>
<SCRIPT LANGUAGE=JAVASCRIPT>
document.form2.hW.focus();
</SCRIPT>
=============================

The statement, document.form2.hW.focus();, makes the number (default or new)
appear in the box when the page loads or reloads.

If there is a better way, let me know.

Thanks,
Jeff
Jul 20 '05 #4
=============================
<form name=form2>
<input type=button onClick="resetFile()" value="Reset/Reload">
Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.value=parent.upper.heightWidth' >

</form>
<SCRIPT LANGUAGE=JAVASCRIPT>
document.form2.hW.focus();
</SCRIPT>
=============================
This works fine in IExplorer. I was just checking Netscape 4.8 and I notice the
new value of hW goes back to the default, not the new number.

setFile() is in an external js file. The function is

function resetFile() {
parent.upper.heightWidth = parent.viewer.document.form2.hW.value;
parent.viewer.document.location.href = "chimeviewer.html"

}
Jul 20 '05 #5
>=============================
<form name=form2>
<input type=button onClick="resetFile()" value="Reset/Reload">
Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.value=parent.upper.heightWidth' >
</form>
<SCRIPT LANGUAGE=JAVASCRIPT>
document.form2.hW.focus();
</SCRIPT>
=============================
This works fine in IExplorer. I was just checking Netscape 4.8 and I notice
the
new value of hW goes back to the default, not the new number.


Actually, I was just rechecking and I notice that anytime I click on the page
the value of hW always goes back to the default in Netscape 4.8.
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
4
by: mitch-co2 | last post by:
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT...
10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
4
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person...
8
by: FUGATO | last post by:
I need to help in my assignment. I need to wrap a text with the following indications: 1.If you have reached the end of the line (number of characters on this line >= 40) AND you have reached the...
6
by: neelay1 | last post by:
Hi all, I have a Javascript variable that contains the name of a form input- input_name = "document.myform.ip" How can I get the value of this form input, "ip" using the variable input_name?...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
13
by: sugard | last post by:
Abstract Class, Inheritance, Polymorphism, File Handling, Exception Handing A program is to be devised for a university to work out whether or not, a student or a professor, is outstanding. The...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.