PDA

View Full Version : help dropdown box



Anders87
04-30-2011, 07:58 PM
Hello!
Sitting with this script for a dropdown menu. I have three languages ​​in a drop down menu and three radio buttons. Swedish, English, German I want each radio button to be highlighted with the same language I select in the dropdown menu. I have tried all different variations I can think of but have not succeeded. I have only managed to get two languages ​​to function.

Someone who wants to show me how I should have done?
Grateful for answers.

The script looks as follows

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<script type="text/javascript">
function autocheck(s,e){
var r= s.form.elements['valdspråk'];
if(e!=0){(e==1||e==3)?r[0].checked=true:r[1].checked=true;}
else{r[0].checked=r[1].checked=false;}
}
</script>
</head>
<body>
<form>
<select name="Språk" onchange="autocheck(this,this.selectedIndex)">
<option>- Välj språk -</option>
<option value='Svenska'>Svenska</option>
<option value='Engelska'>Engelska</option>
<option value='Tyska'>Tyska</option>
</select>
<input type=radio name="valdspråk" value="S">Svenska</label>
<input type=radio name="valdspråk" value="E">Engelska</label>
<input type=radio name="valdspråk" value="T">Tyska</label>
</form>
</body>
</html>