NND,有这么奇怪的事,帮忙看下 老是说typeurl没定义,明明没问题,受不了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script>window.onload=function(){ var mytypeurl=mytype.getElementsByTagName("a"); for(j=0;j<mytypeurl.length;j++){ var typeurl=mytypeurl[j].name; mytypeurl[j].onclick = function(){ clickstyle(typeurl); }; }}function clickstyle(std){ alert(std)}</script><div class="type" id="mytype"><div class="type_menu"><ul><li style="border-left:1px solid #bebebe;"><a href="javascript:void(0);" name="manage_goods.asp?act=1" id="selected">首页是不是</a></li><li><a href="javascript:void(0);" name="manage_goods.asp?act=2" >首页是不是</a></li></ul></div></div> mytypeurl[j].onclick=new Function("clickstyle(typeurl)"); 我开始那个还有闭包问题,得到的都是一样的,用这个就好了...<script>window.onload=function(){ var mytypeurl=mytype.getElementsByTagName("a"); for(j=0;j<mytypeurl.length;j++){ (function(typeurl){ mytypeurl[j].onclick = function(){ clickstyle(typeurl); } })(mytypeurl[j].name) }}function clickstyle(std){ alert(std)}</script><div class="type" id="mytype"><div class="type_menu"><ul><li style="border-left:1px solid #bebebe;"><a href="javascript:void(0);" name="manage_goods.asp?act=1" id="selected">首页是不是</a></li><li><a href="javascript:void(0);" name="manage_goods.asp?act=2" >首页是不是</a></li></ul></div></div> 击球一句话代码 Extjs组件之间的整合问题。 如何操作已用showModelessDialog打开的窗口内值? 窗口效果 菜单项的奇怪问题,急等 为什么不能用dojo 高分求段代码 关于onclick事件如何在最后验证成功后跳到下一个页面。 帮忙看看 ie10+css实现图片旋转90度 浏览器问题 利用JQuery实现单击一个Button显示或隐藏一个div
<script>
window.onload=function(){
var mytypeurl=mytype.getElementsByTagName("a");
for(j=0;j<mytypeurl.length;j++){
var typeurl=mytypeurl[j].name;
mytypeurl[j].onclick = function(){
clickstyle(typeurl);
};
}
}
function clickstyle(std)
{
alert(std)
}
</script>
<div class="type" id="mytype">
<div class="type_menu"><ul><li style="border-left:1px solid #bebebe;"><a href="javascript:void(0);" name="manage_goods.asp?act=1" id="selected">首页是不是</a></li><li><a href="javascript:void(0);" name="manage_goods.asp?act=2" >首页是不是</a></li></ul></div>
</div>
<script>
window.onload=function(){
var mytypeurl=mytype.getElementsByTagName("a");
for(j=0;j<mytypeurl.length;j++){
(function(typeurl){
mytypeurl[j].onclick = function(){
clickstyle(typeurl);
}
})(mytypeurl[j].name)
}
}
function clickstyle(std)
{
alert(std)
}
</script>
<div class="type" id="mytype">
<div class="type_menu"><ul><li style="border-left:1px solid #bebebe;"><a href="javascript:void(0);" name="manage_goods.asp?act=1" id="selected">首页是不是</a></li><li><a href="javascript:void(0);" name="manage_goods.asp?act=2" >首页是不是</a></li></ul></div>
</div>