应该为
function administrationNoticeInit(index)
{
alert(index);
}
着急忘了!
高手们帮帮忙啊!
function administrationNoticeInit(index)
{
alert(index);
}
着急忘了!
高手们帮帮忙啊!
解决方案 »
- 推荐一款正则表达式调试工具,内置经典例程~
- js 获取光标的位置。
- JQUERY $("form:first").submit();在IE6下面不执行,咱整
- js有没有知道tan(Q)的角度(Q)后求sin(Q)或cos(Q)的函数
- ie 中的 insertAdjacentElement 在firefox中怎样实现的
- 请问"event.srcElement.previousSibling.previousSibling.uniqueID" 是什么意思?
- 求助啊!!!!!!!获取到该页面的URL?并显示出来?
- 我想在WEB页中使用SLIDER(滑动条),不知道有什么好办法?只有用OCX控件吗?如何实现呢?谢谢
- 高手谈showModalDialog窗口===在线等等
- 如何在前端控制只能输入数字和小数点?
- 动态数据存数据
- 一个框架页中怎么用JS来判断框架页中的另一个页面是否加载完成?
function administrationNoticeMenuInit()
{
var row = document.createElement("tr");
var cell=null,img=null;
for(var i=0;i<4;i++)
{
cell = document.createElement("td");
img = document.createElement("img");
img.setAttribute("id","administrationNotice"+i);
img.setAttribute("src","../images/index1_0"+i+".jpg");
if(document.uniqueID)
{
img.style.cssText = "cursor: hand;";
}
else
{
img.setAttribute("style","cursor: hand;");
}
img.onclick = function() { administrationNoticeInit(this) };
cell.appendChild(img);
row.appendChild(cell);
}
administrationNoticeMenu.appendChild(row);
}
function administrationNoticeInit(o)
{
var id=o.getAttribute("id");
var pos=id.substring(20); //
alert(pos+":"+id);
}
to mingxuan3000(铭轩):
你的方法,测试了,没有任何反应!下面我把完整的函数写出来:
function administrationNoticeMenuInit()
{
var data = AjaxClass.GetMenu(24);
var row = document.createElement("tr");
var cell=null,img=null,nodeId;
for(var i=0;i<data.value.Tables[0].Rows.length;i++)
{
cell = document.createElement("td");
img = document.createElement("img");
img.setAttribute("id","administrationNotice"+i);
img.setAttribute("src","../images/index1_0"+i+".jpg");
if(document.uniqueID)
{
img.style.cssText = "cursor: hand;";
}
else
{
img.setAttribute("style","cursor: hand;");
}
nodeId = data.value.Tables[0].Rows[i].nodeId;
img.onclick = function() { administrationNoticeInit( nodeId , i ) }; cell.appendChild(img);
row.appendChild(cell);
}
administrationNoticeMenu.appendChild(row);
}function administrationNoticeInit(nodeId,num)
{
alert(nodeId+"&"+num); switch(num)
{
case 0:
document.getElementById('administrationNotice0').src='../images/index2_00.jpg';
document.getElementById('administrationNotice1').src='../images/index1_01.jpg';
document.getElementById('administrationNotice2').src='../images/index1_02.jpg';
document.getElementById('administrationNotice3').src='../images/index1_03.jpg';
break;
case 1:
document.getElementById('administrationNotice0').src='../images/index1_00.jpg';
document.getElementById('administrationNotice1').src='../images/index2_01.jpg';
document.getElementById('administrationNotice2').src='../images/index1_02.jpg';
document.getElementById('administrationNotice3').src='../images/index1_03.jpg';
break;
case 2:
document.getElementById('administrationNotice0').src='../images/index1_00.jpg';
document.getElementById('administrationNotice1').src='../images/index1_01.jpg';
document.getElementById('administrationNotice2').src='../images/index2_02.jpg';
document.getElementById('administrationNotice3').src='../images/index1_03.jpg';
break;
case 3:
document.getElementById('administrationNotice0').src='../images/index1_00.jpg';
document.getElementById('administrationNotice1').src='../images/index1_01.jpg';
document.getElementById('administrationNotice2').src='../images/index1_02.jpg';
document.getElementById('administrationNotice3').src='../images/index2_03.jpg';
break; }
var data = AjaxClass.GetAdministrationNoticeList_Pre(nodeId);
if(document.getElementById("administrationNotice").hasChildNodes())
{
var count = document.getElementById("administrationNotice").childNodes.length;
for(var i=0;i<count;i++)
{
document.getElementById("administrationNotice").removeChild(document.getElementById("administrationNotice").childNodes[0]);
}
}
setTbody_threeCell(data,31,"administrationNotice","../images/but3.jpg",1,"15px","455px");
}需要传两个参数!
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY><div id="result"><li>AAAAA</li>
<li>BBBbb</li></div>
<div id="a">test</div> <table><tr>
<td><input type="checkbox" name="checks" onclick="changeValues(this)"><input type="hidden" name="hids" value="0"></td>
<td><input type="text" name="t" value="aaaaa"></td>
</tr>
<tr>
<td><input type="checkbox" name="checks" onclick="changeValues(this)"><input type="hidden" name="his" value="0"></td>
<td><input type="text" name="t" value="bbb"></td>
</tr>
</table>
<input type="button" name="aa" value="asdf" >
<input type="button" name="aa" value="asdf" >
<input type="button" name="aa" value="asdf" >
<input type="button" name="aa" value="asdf" >
<tr>===================================
<input type="button" name="bb" value="asdf" >
<input type="button" name="bb" value="asdf" >
<input type="button" name="bb" value="asdf" >
<input type="button" name="bb" value="asdf" >
</BODY>
<script language="javascript">function a(b,c){
alert(b+c)
}
function b(){
var bb=document.getElementsByName("aa")
for(var i=0;i<4;i++){
bb[i].onclick=function() { a("aa",i)}
}
}
b()
function c(){
var dd=document.getElementsByName("bb")
for(var ii=0;ii<4;ii++){
dd[ii].onclick=(function(ii) { return function (){a("bb",ii)}})(ii)
}
}
c()
</script>
</HTML>
function a(b,c){
alert(b+c)
}
function b(){
var bb=document.getElementsByName("aa")
for(var i=0;i<4;i++){
bb[i].onclick=new Function("a('aa',"+i+")")
//new Function("a('aa',"+i+")")
}
}
b()
问题已经解决!
非常感谢!!!
最后想问一下,这种方法除了IE以外的其他浏览器上也能正常使用吗?