I have a problem opening popups in javascript. I have this function to open my popups in IE6 and IE7:
function open_window(Location,w,h) //opens new window { var win = "width="+w+",height="+h+",menubar=no,location=no,resizable,scrollbars,top=500,left=500"; alert(win) ; window.open(Location,'newWin',win).focus(); }
it works. I mean, my new window opens, but an error occurs. Error message:
'window.open (...)' is null, this is not an object.
Do you want to expect a script to run on this page?
then I have a button in the onclick event, it will call a function to close the current window, update the open function
function refreshParent(location) { window.opener.location.href = location ; window.close(); }
it also gives me an error: window.opener.location is null or not an object, but I'm sure I'm passing the correct parameters
I call it this way:
for the second part:
<input type="button" name="pay" value="test" onclick="refreshParent('index.php?module=payment&task=default')" >
for the first part:
<a onclick="javascript:open_window('?module=cart&task=add&id=<?=$res[xproductid]?>&popup=on','500' , '500')" style="cursor:pointer" id="addtocard"> <img src="../images/new_theme/buy_book.gif" width="123" border="0"/> </a>
it really bothers me. Please, help;)