Hi,
I've got a link nested inside a form which, when clicked, should open a new window. Whilst it's doing this it also opens the page in the existing parent window as well.
I didn't write the code however, and it worked when not placed in a form. Is the onClick event of the form getting confused with the onclick event of the window?
Heres the header code:
- <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>
And the link code for the new window:
- <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>
And the onClick event of the form in which the link is nested:
- <form action="Devaction_add.cfm" method="post" name="form" onKeyUp="highlight(event)" onClick="highlight(event)"
-
-
onsubmit="return formCheck(this);">
Can anyone help?
Thanks
Neil