Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need some help to edit javascript function so the link opens in new window

    I have the following html code, that is an input Button and onclick runs the javascript function EnquiriesReport().

    Code:
    <input type="Button" name="Enquiries" value=".Enquiries" onClick="EnquiriesReport()" class="formsubmitTwo">
    Here is the javascript code for the EnquiriesReport() function:
    Code:
    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

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    Quote Originally Posted by keek2a4 View Post
    I have the following html code, that is an input Button and onclick runs the javascript function EnquiriesReport().

    Code:
    <input type="Button" name="Enquiries" value=".Enquiries" onClick="EnquiriesReport()" class="formsubmitTwo">
    Here is the javascript code for the EnquiriesReport() function:
    Code:
    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

    Code:
    <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~


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •