Solved

simple window.open gives me "Invalid argument" error only in Internet explorer

Posted on 2006-10-24
1
4,768 Views
Last Modified: 2012-08-13
can someone tell me why in the following code, first link work and secont doesnt (only in internet explorer). how can i tweak it?

thanks in advance

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function open_postcode() {
      var postcode = document.getElementById ('WwwCustomerPostcode');
      var ppp = postcode.value;
      var sss = "/www_customers/codeplus/"+ppp;//+postcode.value;//+'/'+property.value;
      alert(sss);
      MM_openBrWindow(sss,"Spring Harvest Holidays","width=780,height=600");
};
//-->
</script>
</head>

<body>
<p><a href="javascript:MM_openBrWindow('/customers/show/2','ddd','width=300,height=200')">first link</a>
  <br />
    <a href="javascript:open_postcode()">second link</a></p>
<form id="form1" name="form1" method="post" action="">
  <label>WwwCustomerPostcode
  <input type="text" name="textfield" id="WwwCustomerPostcode" />
  </label>
</form>
</body>
</html>
0
Comment
Question by:kirez
1 Comment
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 150 total points
ID: 17801403
"Spring_Harvest_Holidays"

Although what is the point to pass 3 parameters to a function that use the parameters to call window.open with the same 3 parameters?

Also do yourself a favour and use



function open_postcode() {
     var postcode = document.getElementById ('WwwCustomerPostcode');
     var ppp = postcode.value;
     var sss = "/www_customers/codeplus/"+ppp;//+postcode.value;//+'/'+property.value;
     alert(sss);
     var w=window.open(sss,"Spring_Harvest_Holidays","width=780,height=600");
     if (!w) alert('Please allow popups')
     return false; // cancel the link
};

<a href="/customers/show/2" target="ddd"
onClick="w=window.open(this.href,this.target,'width=300,height=200'); return (w)?false:true">first link</a>

and
<a href="#" onClick="return open_postcode()">second link</a>

to handle popup blockers and to not unload the page when clicking a link that does not leave the page
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now