61,112
社区成员
发帖
与我相关
我的任务
分享
<select onchange="iframe_banner1.location.href=this.value" name="select">
<option value="http://www.sina.com" selected="selected">新浪</option>
<option value="http://cctv.com">cctv|2345</option>
<option value="http://www.qq.com">QQ</option>
</select >
<html>
<head><title>TEST</title></head>
<style type="text/css">
*{font-family:verdana; font-size:12px; margin:0; padding:0}
</style>
<script language="javascript">
function openLink(){
var v=document.getElementById("select1").value.split("|");
var iLink,iTxt;
for(var i=0;i<v.length;i++){
iLink=document.createElement("a");
iTxt=document.createTextNode("iLink"+i)
iLink.appendChild(iTxt);
iLink.href=v[i];
try{
iLink.target="openWin"+i;
}catch(e){
iLink.target="_blank";
}
iLink.style.display="none";
document.getElementById("doc").appendChild(iLink);
iLink.click();
iLink=null;
}
}
</script>
<body id="doc">
<select onchange="javascript:openLink();" id="select1" name="select1">
<option value="http://www.sina.com" selected="selected">新浪</option>
<option value="http://www.cctv.com|http://www.2345.com">cctv|2345</option>
<option value="http://www.qq.com">QQ</option>
</select >
打开连接<br>
window 0
<hr size="1" color="#CCCCCC">
<iframe name="openWin0" id="openWin0" width="100%" height="40%" frameborder="0"></iframe>
<br>
window 1
<hr size="1" color="#CCCCCC">
<iframe name="openWin1" id="openWin1" width="100%" height="40%" frameborder="0"></iframe>
</body>
</html>