Hi everybody,
I made a function JS which detect browser’s version.
I want to set a field or computed field in my form to automatically select menu for each different browser.
ex: ff3 use menu ff3, ie7 use menu IE7 … etc
The function i create is in the header of a form :
function JSbrowser() {
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
ffversion=new Number(RegExp.$1);
if (ffversion>=3){
TMP = "FF 3.x";
document.forms[0].testJS.value=TMP;
alert(TMP);
}else if (ffversion>=2){
TMP = "FF 2.x";
alert("FF 2.x");
}else if (ffversion>=1){
TMP = "FF 1.x";
alert("FF 1.x");
}
}
else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
ieversion=new Number(RegExp.$1);
if (ieversion>=8){
TMP = "IE 8.x";
alert("IE 8.x");
}else if (ieversion>=7){
TMP = "IE 7.x";
alert(TMP);
}else if (ieversion>=6){
TMP = "IE 6.x";
alert("IE 6.x");
}else if (ieversion>=5){
TMP = "IE 5.x";
alert("IE 8.x");
}
}
else{
TMP = "Safari";
alert(TMP);
}
}
When i am on the website alert JS are ok but it doesn t put the value "TMP3 into the field “testJS”.
I set title and ID to"testJS" in html options of the testJS notes field.
Someone can help me please !