473,799 Members | 3,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9927
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='docum ent.myform1.f2. value=this.valu e'>
<br /><br />
Field2: <input name='f2'>
</form>

or

<form name='myform2'>
Field1: <input name='f1'>
<br /><br />
Field2: <input name='f2' onFocus='this.v alue=document.m yform2.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******@earthl ink.net had written. I got it to do the above with

=============== ==============
<form name=form2>
<input type=button onClick="resetF ile()" value="Reset/Reload">
&nbsp;&nbsp;&nb sp; Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.v alue=parent.upp er.heightWidth' >

</form>
<SCRIPT LANGUAGE=JAVASC RIPT>
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="resetF ile()" value="Reset/Reload">
Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.v alue=parent.upp er.heightWidth' >

</form>
<SCRIPT LANGUAGE=JAVASC RIPT>
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.he ightWidth = parent.viewer.d ocument.form2.h W.value;
parent.viewer.d ocument.locatio n.href = "chimeviewer.ht ml"

}
Jul 20 '05 #5
>============== ===============
<form name=form2>
<input type=button onClick="resetF ile()" value="Reset/Reload">
Height and Width of Chime window=
<INPUT NAME="hW" size="6" onFocus='this.v alue=parent.upp er.heightWidth' >
</form>
<SCRIPT LANGUAGE=JAVASC RIPT>
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
6317
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 the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
4
4136
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 the NO radio button, once I do that it will not work. Any help would be greatly appreciated. Mitch
10
3364
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 anybody know how I could do this?
4
9700
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 writing the JavaScript doesn't have to pass the index in the "onChange" event name. I thought that one might be able to use "this.value" or compare this as
8
3694
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 end of the current word, start a new line and reset the number of characters on the line to 0. The end of a word will be denoted by one of these: blank space, '\n', '.', ',' or ';'. #include <stdio.h> #include <ctype.h>
6
1894
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? input_name.value returns undefined value and input_name + ".value" returns the string document.myform.ip.value Any help will be highly appreciated. Thanks,
7
3821
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 database search that I am unable to figure out how to access. (The search is implemented in Php/MySQL.) The user enters search values for: name, address1, city, .... etc., ..... and for each of these they also select whether the search should...
13
1873
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 criterion for a professor to be outstanding is to have over 120 publications. The criterion for a student to be outstanding is to have a Grade Point Average of 3.3. For a professor, the three class data members would be name, number of publications...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.