<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function alert_div(data){
alert(data);
}
function hide(){}
function test(){
var array = new Array(5);
for(var i=0;i<array.length;i++){
array[i]=i;
}
var text = document.getElementById('tt').innerHTML;
for(var i=0;i<array.length;i++){
text += '<a href="#" onmouseover="alert_div('+array[i]+')" onmouseout="hide()">'+array[i]+'</a><br/>';
}
alert(text);
document.getElementById('tt').innerHTML = text;
}
</script></head>
<body onload="test()">
<div id="tt"></div>
</body>
</html>
这个可以啊,我自己加了数据测试了一下
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function alert_div(data){
alert(data);
}
function hide(){}
function test(){
var array = new Array(5);
for(var i=0;i<array.length;i++){
array[i]=i;
}
var text = document.getElementById('tt').innerHTML;
for(var i=0;i<array.length;i++){
text += '<a href="#" onmouseover="alert_div('+array[i]+')" onmouseout="hide()">'+array[i]+'</a><br/>';
}
alert(text);
document.getElementById('tt').innerHTML = text;
}
</script></head>
<body onload="test()">
<div id="tt"></div>
</body>
</html>
这个可以啊,我自己加了数据测试了一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货