Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two uncooperative scripts

Status
Not open for further replies.

TheDocumentEditor

Technical User
May 26, 2001
4
JP
I have two scripts on one page which are conflicting with each other. One is a "Flying Popup" which uses the script source at and has this in the last line:
Code:
window.onload=openpopup
The other script on the same page is for several link enacted popups. I have included it below. If I comment it out (as it is here) then the "Flying Popup" above works. I think the conflict is between the "window.onload=openpopup" in the 'utilpopupfly2.js' and the "window.open" of the following. But I have been wrong before! I know that if there are two onload events you can combine them in the body tag but this is different. How can I get these two to cooperate? What is the trick?
Code:
<!-- 
<script type=text/javascript>
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars=no';
      settings +='toolbar=no';
	  settings +='directories=no';
	  settings +='location=no';
	  settings +='status=no';
	  settings +='menubar=no';
	  settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
</script>-->
[code]
Thanks for your help. 

Bob Robert Kidd, Director
[url]http://www.editfast.com[/url]
Quality Editing==>[i][b][size=4][color=red]Fast[/color][/size][/b][/i] 
[email]Director@EditFast.com[/email]
 
{win.window.focus();}

try it this way instead

{win.focus();}

Hope it`ll help ;-)
Have Fun...

Sharky99 >:):O>
 
Nope. That didn't work. I think I tried that yesterday. I have tried a lot of things but jsut can't get it to work and I know it will somehow. Any other suggestions?

Bob Robert Kidd, Director
High Quality Editing ==>Fast
Director@EditFast.com
 
If you're using the variable win in both scripts, you could run into a problem there. Make your variable names REAL specific so there aren't conflicts between variables when you combine different scripts from the various sources on the Internet.

For the new window, you could use

var newwin=null;

or something similar to that.
 
Copy & paste this code

<!--
<script type=text/javascript>
var popit= '';
function NewWindow(mypage,myname,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings ='&quot;height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no'+',';
settings +='toolbar=no'+',';
settings +='directories=no'+',';
settings +='location=no'+',';
settings +='status=no'+',';
settings +='menubar=no'+',';
settings +='resizable=no&quot;';
popit=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4){popit.focus();}
}
</script>-->

I think it'll work ;-)

Hope it'll help Have Fun...

Sharky99 >:):O>
 
Thanks Sharky and Trollacious. I got it working now with your help but my joy was short lived since there now seems to be a conflict with another script further down the page. It is a &quot;Ticker&quot;. Perhaps this was the problem originally or perhaps they were both the problem. Anyway both popups work but I have to take a look at this ticker and see if I can't figure out what is wrong. If I can't I will be back.

Thanks again

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top