Solved

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

Posted on 2006-10-24
1
4,774 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…
Suggested Courses

623 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