小弟做网页用到一个技术
就是在一个下拉菜单中选中一项,让它在指定的Iframe中打开,现在只能在一个新军窗口中打开,不能在指定 的窗口中打开了
请教一下怎么处理啊
关键原码如下:
<script>
function enterprise(obj){
window.open(obj.value)
}
</script>
<table border="0" cellpadding="0" cellspacing="0" width="760" align="center" >
<tr>
<td background="./images/tab_left.gif" width="400" height="29" class="com_info" colspan="2"> 企业信息大全</td>
</tr>
<tr height="300">
<td width="170" style="border-bottom:1px solid #4E8AC6; border-left:1px solid #4E8AC6; border-right:1px solid #e6e6e6 ;border-top:1px solid #e6e6e6" valign="top">
<select name="info" style="color:#009900 " onChange=enterprise(this)>
<option selected>-请选择-</option>
<option value="http://www.163.com">学校教育</option>
<option value="http://www.sohu.com">医疗卫生</option>
</select>
</td>
<td style="border-bottom:1px solid #4E8AC6; border-rght:1px solid #4E8AC6; ">
<iframe name="i" frameborder="0" width="100%" height="100%" src="./COM_Info/page.htm"></iframe>
</td>
</tr>
</table>
不好意思,我不懂,不过这里的高手如林,肯定有人帮你的
我也不会
换成下面的试试::
<script>
function enterprise(targ,selObj,restore){
eval(targ ".location=';" selObj.options[selObj.selectedIndex>.value "';");
if (restore) selObj.selectedIndex=0;
}
</script>
<table border="0" cellpadding="0" cellspacing="0" width="760" align="center" >
<tr>
<td background="./images/tab_left.gif" width="400" height="29" class="com_info" colspan="2"> 企业信息大全</td>
</tr>
<tr height="300">
<td width="170" style="border-bottom:1px solid #4E8AC6; border-left:1px solid #4E8AC6; border-right:1px solid #e6e6e6 ;border-top:1px solid #e6e6e6" valign="top">
<select name="info" style="color:#009900 " onChange="enterprise(';i';,this,0)">
<option selected>-请选择-</option>
<option value="http://www.163.com">学校教育</option>
<option value="http://www.sohu.com">医疗卫生</option>
</select>
</td>
<td style="border-bottom:1px solid #4E8AC6; border-rght:1px solid #4E8AC6; ">
<iframe name="i" frameborder="0" width="100%" height="100%" src="./COM_Info/page.htm"></iframe>
</td>
</tr>
</table>
哦谢谢 楼上的几位了 |
|