发信人: jzzy.com(jzzy.com) 
整理人: eagle(2002-01-29 09:05:06), 站内信件
 | 
 
 
 现在的网页,页面美观固然重要,但是网友越来越追求操作上的简便性与实用性了,页面上的链接点击是否方便就会显得更重要了,其实主要问题是出在是否点击链接弹出窗口上,如果你事先设置好点击后的情况,网友使用时就会不太方便,现在有了更好的解决办法了,网友可以自己选择打开链接的方式了,只要一个小小的input选择框就一切OK了,很方便的哟,赶快看看吧...... 
 一、普通文字链接:
 <INPUT TYPE="checkbox" onClick="setopen(this.checked)">
 //这里选择这个框后其实也用onClick启动了一个函数
 在新窗口打开
 <SCRIPT>
 <!--
 function setopen(T){ //设置一个打开窗口的函数
 A="_self"; //设置一个参数
 if(T){A="_blank"} //如果选择了setopen后面带参数,就在新窗口(_blank)打开
 var temp=document.links //设置一个写入链接打开方式的参数
 for(i=0;i<temp.length;i++) //设置一个循环,可以对所有的链接起作用
 {
 if(temp[i].Y!=1) //Y!=1是对是否选择了input框的判断
 {
 if (temp[i].target=="") //如果原来的链接没有写target
 {
 temp[i].target=A;temp[i].Y=1} } //写入target参数,同时对input框的选择作判断
 else{temp[i].target=A;} //最简单的情况时写入target
 }
 }
 //-->
 </SCRIPT>
 搜狐 
 新浪网 
 网易 
 
 
 二、下拉菜单链接:
 <script language="javascript">
 <!--
 function gothere(){ //设置一个打开页面的启动函数
 var thebox=document.mycombowopt //设置一个thebox参数,名字与<form>表格对应
 if (thebox.windowoption.checked){ //如果form表格中的一个名字为windowoption的input被选中
 newwindow=window.open("") //设置一个打开窗口的参数
 newwindow.location=
 thebox.example.options[thebox.example.selectedIndex].value //新窗口中打开,打开相应的链接,example为名称
 }
 else
 location=
 thebox.example.options[thebox.example.selectedIndex].value //本地打开链接
 }
 //-->
 </script> 
 <form name="mycombowopt">
 <select name="example" size=1>
 <option value="http://www.163.com">网易</option>
 <option value="http://www.sohu.com">搜狐</option>
 <option value="http://www.sina.com.cn">新浪</option>
 </select> <input type="button" value="打开页面" onClick="gothere()"> <br>
 <input type="checkbox" name="windowoption" value="ON">是否是跳出窗口</p>
 </form> 
 
  | 
 
 
 |