onClick触发到错误的窗口
嗨,
我有一个嵌套在表单中的链接,当单击它时,应该会打开一个新窗口.在这样做的同时,它还会在现有的父窗口中打开页面.
然而,代码不是我写的,当不放在表单中时,它可以正常工作.是否将窗体的onClick事件与窗口的onClick事件混淆?
标题代码如下:
选择 | 换行 | 行号
- <script language="javascript" type="text/javascript">
- <!--
- /****************************************************
- Author: Eric King
- Url: http://redrival.com/eak/index.shtml
- This script is free to use as long as this info is left in
- Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
- ****************************************************/
- var win=null;
- function NewWindow(mypage,myname,w,h,scroll,pos){
- if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*
- ((screen.height-h)-75)):100;}
- if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
- else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
- settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no
- ,toolbar=no,resizable=no';
- win=window.open(mypage,myname,settings);}
- // -->
- </script>
和新窗口的链接代码:
选择 | 换行 | 行号
- <a href="http://marlin/engeastl/scripts/RepairWorkshops/AddNew2.cfm"
- onclick="NewWindow(this.href,'UserAccess','720','340','yes','center');return false" onfocus="this.blur()" class="recordno" style="font-size:
- 1.1em;">Add a New Site</a>
以及链接嵌套的表单的onClick事件:
选择 | 换行 | 行号
- <form action="Devaction_add.cfm" method="post" name="form" onKeyUp="highlight(event)" onClick="highlight(event)"
- onsubmit="return formCheck(this);">
有谁能帮忙吗?
谢谢
尼尔