Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > setting getElementById().value equal to variable value

Reply
Thread Tools

setting getElementById().value equal to variable value

 
 
ll
Guest
Posts: n/a
 
      08-21-2008
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>


 
Reply With Quote
 
 
 
 
ll
Guest
Posts: n/a
 
      08-22-2008
On Aug 21, 7:20 pm, "GArlington" <(E-Mail Removed)> wrote:
> "ll" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
> > 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>
>
>
>
> > <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
 
Reply With Quote
 
 
 
 
GArlington
Guest
Posts: n/a
 
      08-22-2008
On Aug 22, 3:50 pm, ll <(E-Mail Removed)> wrote:
> On Aug 21, 7:20 pm, "GArlington" <(E-Mail Removed)> wrote:
>
>
>
> > "ll" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)...

>
> > > 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>

>
> > > <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


http://www.w3schools.com/jsref/default.asp
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Sharing: Equal upload speeds but un-equal download speeds =?Utf-8?B?TkpU?= Wireless Networking 3 09-15-2007 06:22 AM
How to make equal value shah_satish2002 VHDL 0 07-17-2007 10:06 AM
Setting a variable equal to the "size" of my database vampyreapocalypse@gmail.com ASP General 1 03-15-2006 04:36 AM
strcmp() question, 4 words, two strings, equal return value. Steven C Programming 9 12-29-2005 11:44 PM
equal sign in value portion of xml tag johndesp XML 1 01-19-2004 06:33 PM



Advertisments