SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Udine - Italy
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Open a form in a new window [xhtml strict + javascript]

    Hi,

    I am trying to do open a form in a new window.

    I have looked at other post about this but I didn't get to a solution.

    My form uses some javascript, two forms and a button external to forms who call a javascript function (attached below) that collects forms items values and opens results in the same window.

    Anybody could help in changing javascript so that it opens results in a new window ?

    Code:
    function changeAc(){
    	var search = document.getElementById("querystring").value;	
    	var len = document.getElementById("cat").length;
     for (var i=0;i<len;i++) {
    	if(document.getElementById("mainform").cat[i].selected){
    		var cat = document.getElementById("mainform").cat[i].value;} }
    	    if (cat=="dom1"){
    			document.getElementById("domain_form").domain.value = search;
    			document.getElementById("domain_form").submit();
    			return;	}
             else{ document.getElementById("mainform").action = "http://www.domain.com/file.php"; }
    			  document.getElementById("mainform").submit();  }
    Thanks a lot

  2. #2
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    window.onload = function() {
    document.forms[0].target = "_blank";
    }
    ?
    Simon Pieters


Bookmarks

Posting Permissions

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