Forum Moderators: open

Message Too Old, No Replies

Competing scripts? Not sure how to fix.

         

kslnor

7:16 pm on Aug 18, 2006 (gmt 0)

10+ Year Member



I have two issues pertaining to a couple of scripts I am trying to run on one page: I have a Google Maps script and an image slideshow script. I retrieved the slideshow script from a source on the web, which stated to put the entire script in the source code where I wanted the script executed. When I do this, my Google Maps does not work - the map does not appear. When I move the <script>blah, blah, blah</script> portion of the slideshow to within my <head>tags, the Google Map appears but the starting image of the slideshow does not appear. Following are the two scripts. Can anyone assist? Thank you:

Google Maps:

<head>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAqFNb7WhwKBSkyXBXRRpdvxS37nwARSrOfmv-iie7b2XipFacHhR-MusFDzlhweSG6QKTiMOkZ-LLxg"
type="text/javascript"></script>

<script type="text/javascript">
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(42.26905246408729, -84.20059204101562), 13);

map.openInfoWindow(map.getCenter(),
document.createTextNode("11214 Huckleberry Lane"));

}
}
//]]>
</script>
</head>

<body>
<div id="map" style="width: 500px; height: 325px">
</div>
</body>

Slideshow:

<script language="JavaScript1.2">

/*
Interactive Image slideshow with text description
By Christian Carlessi Salvadó (cocolinks@c.net.gt). Keep this notice intact.
Visit [dynamicdrive.com...] for script
*/

g_fPlayMode = 0;
g_iimg = -1;
g_imax = 0;
g_ImageTable = new Array();

function ChangeImage(fFwd)
{
if (fFwd)
{
if (++g_iimg==g_imax)
g_iimg=0;
}
else
{
if (g_iimg==0)
g_iimg=g_imax;
g_iimg--;
}
Update();
}

function getobject(obj){
if (document.getElementById)
return document.getElementById(obj)
else if (document.all)
return document.all[obj]
}

function Update(){
getobject("_Ath_Slide").src = g_ImageTable[g_iimg][0];
getobject("_Ath_FileName").innerHTML = g_ImageTable[g_iimg][1];
getobject("_Ath_Img_X").innerHTML = g_iimg + 1;
getobject("_Ath_Img_N").innerHTML = g_imax;
}

function Play()
{
g_fPlayMode =!g_fPlayMode;
if (g_fPlayMode)
{
getobject("btnPrev").disabled = getobject("btnNext").disabled = true;
Next();
}
else
{
getobject("btnPrev").disabled = getobject("btnNext").disabled = false;

}
}
function OnImgLoad()
{
if (g_fPlayMode)
window.setTimeout("Tick()", g_dwTimeOutSec*1000);
}
function Tick()
{
if (g_fPlayMode)
Next();
}
function Prev()
{
ChangeImage(false);
}
function Next()
{
ChangeImage(true);
}

////configure below variables/////////////////////////////

//configure the below images and description to your own.
g_ImageTable[g_imax++] = new Array ("11214huckleberry.jpg", "Exterior");
g_ImageTable[g_imax++] = new Array ("11227huckleberry.jpg", "Master Bedroom");
g_ImageTable[g_imax++] = new Array ("11253huckleberry.jpg", "Master Bath");
g_ImageTable[g_imax++] = new Array ("11206huckleberry.jpg", "Living Room");
g_ImageTable[g_imax++] = new Array ("2970hunley.jpg", "Kitchen");
//extend the above list as desired
g_dwTimeOutSec=2

////End configuration/////////////////////////////

if (document.getElementById¦¦document.all)
window.onload=Play

</script>

<p align="center"><input type="button" id="btnPrev" value="<< Previous" onclick="Prev();"> <input type="button" id="bntPlay" value="Play - Stop" onclick="Play()"> <input type="button" id="btnNext" value=" Next >> " onclick="Next();"></p>

<p align="center"><img id="_Ath_Slide" onload="OnImgLoad()"> </p>

<p align="center"><b>Description:</b> <SPAN id="_Ath_FileName"> </SPAN> <br>

<p align="center">

</p>

opifex

3:12 am on Aug 20, 2006 (gmt 0)

10+ Year Member



get your onload functions into one statement

<body onload="dothis();dothat()">

should work