Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Javascript 1

Status
Not open for further replies.

aw23

Programmer
Nov 26, 2003
544
IL
I think this is a pretty simple thing to do but it's been a while and I am stuck. I have a page with a menu. The menu consists of several different languages. When user selects a language I want it to go to the next page, in that langauge.
The following is my code so far. I did not even try to go to the next page, I am just trying to write out the name first to see if it is working. I get no errors but nothing happens.
Can someone help me out? Thanks

function SelectLang()
{
var page=document.all.Langauge.value
document.write(page)
}
</script>

</head>

<body>
<select name="Language" onchange="SelectLang()">

<option id="Choose">Choose language</option>
<option id="English" value=" <option id="French" value=" <option id="Spanish" value=" <option id="German" value=" <option id="Italian" value="</select>
</body>
 
aw23,

If you insist on using document.all, then these are equally viable.
[tt]
var page=document.all("Language").value;
//or
var page=document.all.item("Language").value;
[/tt]
As to document.write, it cannot be. These are equally viable.
[tt]
window.location=page;
//or
document.URL=page;
[/tt]
regards - tsuji
 
Thanks, no I do not insist on using document.all
Can I do
var page=Language.value;
 
aw23,

No, that would assume too much. Other than document.all, using name, you can do for instance this.
[tt]
var page=document.getElementsByName("Language")[0].value
[/tt]
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top