求一个javascript的函数问题!!

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:39:36
这个函数怎么写?
function functionName {

if(浏览器版本为 ie7){
location.href="http://www.tudou.com";
}
}
function functionName {

if(浏览器版本为 ie7){
网页调用另一个同目录下名为abc.css的样式表
}
}

<script type="text/javascript">
if (navigator.appVersion.match('MSIE 7.0')) {
var head = document.getElementsByTagName('HEAD')[0];
var s = document.createElement('link');
s.href = 'abc.css';
s.rel = 'stylesheet';
s.type = 'text/css';
head.appendChild(s);
}
else
alert("This is not IE 7.0.");
</script>

navigator.appName alert下看看就可以判断了..

没看明白楼主要做什么,是相判断IE的版本,还是使用的是什么浏览器?