Hi there,
Problably an easy problem, but could anybody tell me why I am not able to fill the switch-statement with an "function", while I am able to insert a single variable value?
The code I have is as follow:
<html>
<head>
<script type="text/javascript">
function browserversion()
{
browser=navigator.appVersion
var txt=browser.match("3."
/*var txt = "3." when I use this variable the code works I want When I test the var txt with a document.write, in both cases I get the value 3, that why I don't get it!*/
switch(txt)
{
case "2.":
document.write("Your Browser is from the stone-age."
;
break;
case "3.":
document.write("You should update your Browser."
;
break;
case "4.":
document.write("Your Browser is good enough."
;
break;
default:
document.write("Browserversion not known"
;
}
}
</script>
</head>
<body onload="browserversion()">
</body>
</html>
Problably an easy problem, but could anybody tell me why I am not able to fill the switch-statement with an "function", while I am able to insert a single variable value?
The code I have is as follow:
<html>
<head>
<script type="text/javascript">
function browserversion()
{
browser=navigator.appVersion
var txt=browser.match("3."
/*var txt = "3." when I use this variable the code works I want When I test the var txt with a document.write, in both cases I get the value 3, that why I don't get it!*/
switch(txt)
{
case "2.":
document.write("Your Browser is from the stone-age."
break;
case "3.":
document.write("You should update your Browser."
break;
case "4.":
document.write("Your Browser is good enough."
break;
default:
document.write("Browserversion not known"
}
}
</script>
</head>
<body onload="browserversion()">
</body>
</html>