PDA

View Full Version : Combining 'Carousel' and 'Bouncy Message'



edikaufmann
08-08-2006, 09:42 AM
1) Script Title: Combining 'Carousel' and 'Bouncy Message' scripts

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/carousel.htm
http://www.dynamicdrive.com/dynamicindex10/bouncetext.htm

3) Describe problem:

I'm running the 'Carousel' script without any problems. However, as soon as I try to add, on same page, the 'Bouncy Message' script the 'carousel' script isn't shown at all anymore - but the 'Bouncy message' script runs correctly!

What do I need to do to run these two JavaScripts simultaneously!
thanks for your hints
ed



<%@ Page Language="vb" AutoEventWireup="false" Inherits="MLM.main" CodeFile="main.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>main</title>

</HEAD>

<script language="JavaScript" type="text/jscript">
ServerName=window.location.hostname;
//window.alert([ServerName]);

/***********************************************
* Carousel Slideshow script- © Ger Versluis 2003
* Permission granted to DynamicDrive.com to feature script
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/



// 7 variables to control behavior
var Car_Image_Width=274;
var Car_Image_Height=250;
var Car_Border=true; // true or false
var Car_Border_Color="white";
var Car_Speed=2;
var Car_Direction=true; // true or false
var Car_NoOfSides=8; // must be 4, 6, 8 or 12

...... code deleted to shortem msg ......

function C_LdLnk(){if(this.lnk)window.location.href=this.lnk}
function C_Stp(){this.style.cursor=this.lnk?"pointer":"default";C_Stppd=true;}
function C_Rstrt(){C_Stppd=false}
</script>

<style type="text/css">
#supertext {
position:absolute;
Z-INDEX:200;
font-family: Verdana, Arial, Helvetica, sans-serif;
left:300;
top:150;
visibility:hide;
visibility:hidden;
}
</style>

<script language="JavaScript" type="text/jscript">

/*
Bouncy message script- By Dynamicdrive.com
Code based on Lloyd Hassell's, at http://www.dynamicdrive.com/dynamicindex4/bounceimage.htm
For full source, TOS, and 100s DTHML scripts, visit http://dynamicdrive.com
*/

//Configure the below three variables

//1) Set message to display (HTML accepted)
var thecontent='<h2><font color="#00FF00">La Provence Verte<br></font><font color="#0000FF">CentreVAR</font></h2>'
//2) Set delay after which message should be hidden, in miliseconds ('' makes it incessantly visible on the screen)
var hidetimer='';
//3) Set speed of animation (1-50), where larger is faster
var BallSpeed = .8;



///NO NEED TO EDIT BELOW THIS LINE///////////

..... code deleted to shorten msg ................................

if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}
</script>
<body onload="Carousel()" background="/MLMmisc/BGMain.jpg" >
<form id="Form1" method="post" runat="server">
<asp:label id="MLM" style="Z-INDEX: 101; LEFT: 300px; POSITION: absolute; TOP: 60px" runat="server"
Font-Names="Monotype Corsiva" Font-Size="X-Large" Width="464px">Méounes-les-Montrieux</asp:label><asp:label id="Bienvenue" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 40px" runat="server"
Font-Names="Monotype Corsiva" Font-Size="Large" Width="120px">Bienvenue à</asp:label>&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Image id="Panorama" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 112px" runat="server"
Width="724px" Height="200px" ImageUrl="/MLMmisc/MainTop.jpg"></asp:Image>&nbsp;</form>
<div id="Carousel" style="position:relative ; TOP: 280px; LEFT:2px">
<img src="images/placeholder.gif" width="723" height="252"></div>

</body>
</HTML>

jscheuer1
08-08-2006, 02:03 PM
First of all, the carousel script belongs in the body of the page, after the opening body tag. I do not see the opening <body> tag in your code. Additionally, carousel uses onload in the body tag while bouncy uses window onload:


<body onload="Carousel();">

and (near the end of the bouncy script):


window.onload = initializeBall;

respectively. These conflict. One resolution is to get rid of bouncy's window onload call. Simply delete that line from its code and add it to the body tag's onload call like so:


<body onload="initializeBall();Carousel();">

edikaufmann
08-09-2006, 07:39 AM
John,

all is working great!
Many thanks for your time and ideas!
have a good week, ed