User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 429,995 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,422 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1344 | Replies: 2 | Solved
Reply
Join Date: Dec 2007
Posts: 8
Reputation: thompa is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
thompa thompa is offline Offline
Newbie Poster

Using an html form button to open a popup window

  #1  
Jun 27th, 2008
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: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';win=window.open(mypage,myname,settings);}
// -->
</script>

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/fixtur...idweekdiv1.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.

Regards
Allan Thompson
Last edited by ~s.o.s~ : Jun 28th, 2008 at 2:58 am. Reason: Fixed code tags; changed <icode> tags to <code> tags.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,871
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 345
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Using an html form button to open a popup window

  #2  
Jun 28th, 2008
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.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: thompa is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
thompa thompa is offline Offline
Newbie Poster

Re: Using an html form button to open a popup window

  #3  
Jun 29th, 2008
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!

Allan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 12:49 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC