...

View Full Version : need some help to edit javascript function so the link opens in new window



keek2a4
05-14-2009, 05:43 PM
I have the following html code, that is an input Button and onclick runs the javascript function EnquiriesReport().



<input type="Button" name="Enquiries" value=".Enquiries" onClick="EnquiriesReport()" class="formsubmitTwo">

Here is the javascript code for the EnquiriesReport() function:


function EnquiriesReport()
{
if( ValidateData()) {
form1.action="EnquiriesReport.asp?"
form1.submit();
}
}


My question is how can I run the EnquiriesReport() function so that the "EnquiriesReport.asp?" opens in a new window?

Can someone please point me in the right direction.

Thanks,
Ket

ShadowIce
05-14-2009, 06:08 PM
I have the following html code, that is an input Button and onclick runs the javascript function EnquiriesReport().



<input type="Button" name="Enquiries" value=".Enquiries" onClick="EnquiriesReport()" class="formsubmitTwo">

Here is the javascript code for the EnquiriesReport() function:


function EnquiriesReport()
{
if( ValidateData()) {
form1.action="EnquiriesReport.asp?"
form1.submit();
}
}


My question is how can I run the EnquiriesReport() function so that the "EnquiriesReport.asp?" opens in a new window?

Can someone please point me in the right direction.

Thanks,
Ket

Scuse me if Im wrong, but try something like this.

This doesnt work fully, but u should understand now :)


<form name="form1">

<input type="Button" name="Enquiries" value=".Enquiries" onClick="EnquiriesReport()" class="formsubmitTwo">

</form>

<script>
function EnquiriesReport()
{
if( ValidateData()) {
form1.action=newwin('EnquiriesReport.asp?','Enquiries Report','400,300');
form1.submit();
}
}

function newwin(url,title,width,height){

newwindow=window.open(url,title,'width='+width+',height='+height+');
if (window.focus) {newwindow.focus()}
return false;

}
</script>

Good Luck!

~ShadowIce~



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum