Connecting Tech Pros Worldwide Forums | Help | Site Map

setting getElementById().value equal to variable value

ll
Guest
 
Posts: n/a
#1: Aug 21 '08
I'm working with the script below which works with FF but not with IE
7. To clarify, the part of the code which isn't working in IE 7 is
putting the value of variable y in the "totalString" input box and
alert.
Thanks for any help,
Louis
-------------------------------------------------
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value;
document.getElementById("fname").value=x.toUpperCa se();
//var b="used cars";
//alert(x);
}
function numFlag()
{
var y=document.getElementById("number").value;
document.getElementById("totalString").value="hell o"+y;
alert(y);
//document.write y;
}
</script>


<form>
Enter your name: <input type="text" id="fname"
onBlur="upperCase()"><br />
Enter your age: <input type="text" id="age" onBlur="alert(this.id)">
<br><br>
<select name="test" id="number" onChange="numFlag()" size="1">
<option>1</option>
<option>2</option>
<option>3</option>
</select<!---->

<br>
<br><br>
<input name="totalString" id="totalString"></form>



GArlington
Guest
 
Posts: n/a
#2: Aug 22 '08

re: setting getElementById().value equal to variable value


"ll" <barn104_1999@yahoo.comwrote in message
news:8261aacc-77a9-4dd0-bf30-fe19dabf059f@m3g2000hsc.googlegroups.com...
Quote:
I'm working with the script below which works with FF but not with IE
7. To clarify, the part of the code which isn't working in IE 7 is
putting the value of variable y in the "totalString" input box and
alert.
Thanks for any help,
Louis
-------------------------------------------------
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value;
document.getElementById("fname").value=x.toUpperCa se();
//var b="used cars";
//alert(x);
}
function numFlag()
{
var y=document.getElementById("number").value;
document.getElementById("totalString").value="hell o"+y;
alert(y);
//document.write y;
}
</script>
>
>
<form>
Enter your name: <input type="text" id="fname"
onBlur="upperCase()"><br />
Enter your age: <input type="text" id="age" onBlur="alert(this.id)">
<br><br>
<select name="test" id="number" onChange="numFlag()" size="1">
<option>1</option>
<option>2</option>
<option>3</option>
</select<!---->
You might want to give the options above separate values...
<option value ="1">1</option>
Quote:
>
<br>
<br><br>
<input name="totalString" id="totalString"></form>
>
>

** Posted from http://www.teranews.com **
ll
Guest
 
Posts: n/a
#3: Aug 22 '08

re: setting getElementById().value equal to variable value


On Aug 21, 7:20 pm, "GArlington" <garling...@tiscali.co.ukwrote:
Quote:
"ll" <barn104_1...@yahoo.comwrote in message
>
news:8261aacc-77a9-4dd0-bf30-fe19dabf059f@m3g2000hsc.googlegroups.com...
>
Quote:
I'm working with the script below which works with FF but not with IE
7. To clarify, the part of the code which isn't working in IE 7 is
putting the value of variable y in the "totalString" input box and
alert.
Thanks for any help,
Louis
-------------------------------------------------
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value;
document.getElementById("fname").value=x.toUpperCa se();
//var b="used cars";
//alert(x);
}
function numFlag()
{
var y=document.getElementById("number").value;
document.getElementById("totalString").value="hell o"+y;
alert(y);
//document.write y;
}
</script>
>
Quote:
<form>
Enter your name: <input type="text" id="fname"
onBlur="upperCase()"><br />
Enter your age: <input type="text" id="age" onBlur="alert(this.id)">
<br><br>
<select name="test" id="number" onChange="numFlag()" size="1">
<option>1</option>
<option>2</option>
<option>3</option>
</select<!---->
>
You might want to give the options above separate values...
<option value ="1">1</option>
>
>
>
Quote:
<br>
<br><br>
<input name="totalString" id="totalString"></form>
>
** Posted fromhttp://www.teranews.com**


Works like a charm! Many thanks - is there an easy-to-reference
javascript book or site which might be of help for someone who
rarely uses it?


Thanks
GArlington
Guest
 
Posts: n/a
#4: Aug 22 '08

re: setting getElementById().value equal to variable value


On Aug 22, 3:50 pm, ll <barn104_1...@yahoo.comwrote:
Quote:
On Aug 21, 7:20 pm, "GArlington" <garling...@tiscali.co.ukwrote:
>
>
>
Quote:
"ll" <barn104_1...@yahoo.comwrote in message
>
Quote:
news:8261aacc-77a9-4dd0-bf30-fe19dabf059f@m3g2000hsc.googlegroups.com...
>
Quote:
Quote:
I'm working with the script below which works with FF but not with IE
7. To clarify, the part of the code which isn't working in IE 7 is
putting the value of variable y in the "totalString" input box and
alert.
Thanks for any help,
Louis
-------------------------------------------------
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value;
document.getElementById("fname").value=x.toUpperCa se();
//var b="used cars";
//alert(x);
}
function numFlag()
{
var y=document.getElementById("number").value;
document.getElementById("totalString").value="hell o"+y;
alert(y);
//document.write y;
}
</script>
>
Quote:
Quote:
<form>
Enter your name: <input type="text" id="fname"
onBlur="upperCase()"><br />
Enter your age: <input type="text" id="age" onBlur="alert(this.id)">
<br><br>
<select name="test" id="number" onChange="numFlag()" size="1">
<option>1</option>
<option>2</option>
<option>3</option>
</select<!---->
>
Quote:
You might want to give the options above separate values...
<option value ="1">1</option>
>
Quote:
Quote:
<br>
<br><br>
<input name="totalString" id="totalString"></form>
>
Quote:
** Posted fromhttp://www.teranews.com**
>
Works like a charm! Many thanks - is there an easy-to-reference
javascript book or site which might be of help for someone who
rarely uses it?
>
Thanks
http://www.w3schools.com/jsref/default.asp
Closed Thread