Hi there,
I have had a script on my web site which opens a popup window when clicked. It works in Firefox and I am sure that it worked in IE6 - but it does not work in IE7.

The javascript part is from Eric King who posted the script on to DynamicDrive.com:-

<script language="javascript" type="text/javascript">
     Author: Eric King
     Url: [url]http://redrival.com/eak/index.shtml[/url]
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library ([url]http://www.dynamicdrive.com[/url])
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
// -->

The calling line is:-

<input name='button1' type='button' href ="2coupleweekend/table2coupleweekend1.html" title="2 Couple Weekend League - Table" onClick="NewWindow(this.getAttribute('href'),this.getAttribute('title'),'500','350','no','center');return false" value=" View League Table ">

Please try it at :- http://nkelsey.byethost24.com/fixtures/fixtures2couplemidweekdiv1.php
by clicking on the 'View League Table' button.
As I said, it works in Firefox but not IE7.

Can anyone help me make it work in both... or does anyone have another script or way of performing the same operation... or other idea as to how I can achieve the same end?

Thanks in anticipation.

Allan Thompson

Recommended Answers

All 2 Replies

On the surface the code looks error free though I am pretty sure that IE doesn't play well with getAttribute and setAttribute . Just replace them with this.href and this.title (or better yet, just pass this !). If you still are unable to find a solution, there are a few IE Javascript debuggers out there which you can put to good use in your case.

Thanks for that.

I hadn't realised that IE caused a problem with this code. I searched and found many sites with information on the issue. Apparently Microsoft have decided to ignore the w3 standard and any getAtrribute in IE reveals 'null' when it shouldn't.

There doesn't seem to be a good workaround... unless anyone knows differently, of course!

Will have to think of another way.. although it seems that I may be forced to forgo the button idea entirely! Shame on Microsoft!


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.