<title>无标题文档</title>
<script>
var buttonMap={
"/index.asp":1, 这里声明变量为什么要带上:1
"/about.html":2,
"/news.asp":3,
"/products.asp":4
}
window.attachEvent("onload",function(){
for(var s in buttonMap)
if(location.href.indexOf(s)>0){ 这里查找到的值是什么,如果URL是http://127.0.0.1/about.html
oTopNav.cells[1].id="bg1"; cells[1].这个值是什么意思
oTopNav.cells[buttonMap[s]].id="bg2"; cells[buttonMap[s]].这个值是多少
break;
}
});
</script>
<style type="text/css">
#bg1{
font-weight:bold;
font:Arial, Helvetica, sans-serif;
}
#bg2{
font-weight:bold;
font:Arial, Helvetica, sans-serif;
}
#bg1 a:link, #bg1 a:visited {
color: #FF9900;
text-decoration: none
}
#bg1 a:hover, #bg1 a:active {
color: #33FF99;
text-decoration: none;
}
#bg2 a:link, #bg2 a:visited {
color: #66CCFF;
text-decoration: none;
}
</style></head>
<body>
<br />
<table width="500" height="17" border="0" cellpadding="0" cellspacing="0" id="oTopNav">
<tr>
<td></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="index.asp">Home</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="about.html">About</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="news.asp">News</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="products.asp">Products</a></td>
<td width="200"></td>
</tr>
</table>
</body>
</html>
<script>
var buttonMap={
"/index.asp":1, 这里声明变量为什么要带上:1
"/about.html":2,
"/news.asp":3,
"/products.asp":4
}
window.attachEvent("onload",function(){
for(var s in buttonMap)
if(location.href.indexOf(s)>0){ 这里查找到的值是什么,如果URL是http://127.0.0.1/about.html
oTopNav.cells[1].id="bg1"; cells[1].这个值是什么意思
oTopNav.cells[buttonMap[s]].id="bg2"; cells[buttonMap[s]].这个值是多少
break;
}
});
</script>
<style type="text/css">
#bg1{
font-weight:bold;
font:Arial, Helvetica, sans-serif;
}
#bg2{
font-weight:bold;
font:Arial, Helvetica, sans-serif;
}
#bg1 a:link, #bg1 a:visited {
color: #FF9900;
text-decoration: none
}
#bg1 a:hover, #bg1 a:active {
color: #33FF99;
text-decoration: none;
}
#bg2 a:link, #bg2 a:visited {
color: #66CCFF;
text-decoration: none;
}
</style></head>
<body>
<br />
<table width="500" height="17" border="0" cellpadding="0" cellspacing="0" id="oTopNav">
<tr>
<td></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="index.asp">Home</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="about.html">About</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="news.asp">News</a></td>
<td width="75" align="center" valign="middle" id="bg1" ><a href="products.asp">Products</a></td>
<td width="200"></td>
</tr>
</table>
</body>
</html>
解决方案 »
- jQuery EasyUI Combobox如何隐藏?
- js乱码的问题
- <div>元素的id属性不能用document.getElementById()获得,为何?
- 如何用正则实现把“xyz(0/0)”中的0、0分别加1和2
- debug求思路:IE10及以前的浏览器不能正确打开页面
- 浮动按钮,给分!………………
- 如和执行一个串里的代码,如var str="document.Form1.Date.value=100";
- 100分求助,框架中各网页产生的先后顺序是什么?
- 小问题,解决后立刻给分!!!
- 为什么用setTimeout做的记时器有时停不下来?
- extjs table布局的问题
- ajax get 中文参数的时候为什么需要转码
"/index.asp":1, 这里声明变量为什么要带上:1
"/about.html":2,
"/news.asp":3,
"/products.asp":4
}
window.attachEvent("onload",function(){
for(var s in buttonMap)
if(location.href.indexOf(s)>0){ 这里查找到的值是什么,如果URL是http://127.0.0.1/about.html
location.href中查找/index.asp,/about.html,/news.asp,/products.asp,所以如果URL是http://127.0.0.1/about.html 找到到 "/about.html":2,
oTopNav.cells[1].id="bg1"; cells[1].这个值是什么意思table 的第一个单元格,通过table ID去
oTopNav.cells[buttonMap[s]].id="bg2"; cells[buttonMap[s]].这个值是多少buttonMap[s]=2
break;
}
});
</script>