1 Replies - 3568 Views - Last Post: 17 May 2005 - 08:18 PM

#1 heroinesse   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-May 05

Using more than 1 script in the same page?

Posted 14 May 2005 - 07:37 AM

I don't know a whole lot about Javascript. I basically get the code and paste it.

I have run into a problem:

I am trying to use two different scripts on the same page and the first works, but the second does not.

First one: A script that rotates photos (by GIF Banner Maker)
Second one: A script for a popup window

The scripts are fine and work on separate pages, but when combined, only the first one with the photos works.

Here's my code:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">
<script language='javascript'>
Use the code for FREE but leave this message intact
Download your FREE CGI/Perl Scripts today!
( http://www.cgiscript.net/scripts.htm )
var CruiseWindow=null;
function Cruise(mypage,myname,w,h,pos,infocus){
else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
<script language="Javascript" type="text/Javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
Down at the bottom of the page, an additional line for the popup window:
<body onload="Cruise('http://www.nphchq.org/popup.htm','Cruise','462','184','center','front');">

Is This A Good Question/Topic? 0
  • +

Replies To: Using more than 1 script in the same page?

#2 brokenyoyo   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 17-May 05

Re: Using more than 1 script in the same page?

Posted 17 May 2005 - 08:18 PM

I think I may know the solution to your problem but, I don't think any one is going to see the popup, I know i wouldn't (Thank God for popup blockers!). I'll help you, but only because I'm feeling helpful!

Look of and erase the following lines:

<script language="Javascript" type="text/Javascript">

You put both scripts in to one set of script tags. That should work; but then again I don't know Javascript to well. I've wrote some scripts, but ended up not using them. :P
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1