/    Sign up×
Community /Pin to ProfileBookmark

Help with picture script

The problem i have with this script is that when it changes pictures it changes the first image on the page which is in the main nav header….Anywayy to alter so it wont do that? It works fine on a page without the nav menu…

<script>

var iImage = 1;

var LAST_IMAGE = 17;

var NarrateStrings = new Array(LAST_IMAGE);

// Start loading the pictures…

NarrateStrings[0] = “Tucker takes the turn overlooking the landscape below”;
NarrateStrings[1] = “The Three Amigos”;
NarrateStrings[2] = “Cruiser navigates the technical terrain”;
NarrateStrings[3] = “Moab hoists the bike and shows off his wooden leg”;
NarrateStrings[4] = “Priceless”;
NarrateStrings[5] = “The most scenic shot ever taken of a guy peeing. Thanks Tucker!”;
NarrateStrings[6] = “Moab drops the rock”;
NarrateStrings[7] = “The money shot. Instant wallpaper.”;
NarrateStrings[8] = “Cruiser navigates the switchback”;
NarrateStrings[9] = “Cruiser and Tucker going opposite ways”;
NarrateStrings[10] = “Tucker rolls the log”;
NarrateStrings[11] = “”;
NarrateStrings[12] = “Extreme Closeup”;
NarrateStrings[13] = “Tucker navigates the sweet singletrack”;
NarrateStrings[14] = “Moab lounging on top of the world”;
NarrateStrings[15] = “Moab navigates the crossing”;
NarrateStrings[16] = “Cruiser and Tucker starring in The Sound of Music”;
NarrateStrings[17] = “”;
NarrateStrings[18] = “”;
NarrateStrings[19] = “”;
NarrateStrings[20] = “”;
NarrateStrings[21] = “”;
NarrateStrings[22] = “”;
NarrateStrings[23] = “”;
NarrateStrings[24] = “”;
NarrateStrings[25] = “”;
NarrateStrings[26] = “”;
NarrateStrings[27] = “”;
NarrateStrings[28] = “”;
NarrateStrings[29] = “”;
NarrateStrings[30] = “”;
NarrateStrings[31] = “”;
NarrateStrings[32] = “”;
NarrateStrings[33] = “”;
NarrateStrings[34] = “”;
NarrateStrings[35] = “”;
NarrateStrings[36] = “”;
NarrateStrings[37] = “”;
NarrateStrings[38] = “”;
NarrateStrings[39] = “”;
NarrateStrings[40] = “”;
NarrateStrings[41] = “”;
NarrateStrings[42] = “”;
NarrateStrings[43] = “”;
NarrateStrings[44] = “”;
NarrateStrings[45] = “”;
NarrateStrings[46] = “”;
NarrateStrings[47] = “”;
NarrateStrings[48] = “”;
NarrateStrings[49] = “”;
NarrateStrings[50] = “”;
NarrateStrings[51] = “”;
NarrateStrings[52] = “”;
NarrateStrings[53] = “”;
NarrateStrings[54] = “”;
NarrateStrings[55] = “”;
NarrateStrings[56] = “”;
NarrateStrings[57] = “”;
NarrateStrings[58] = “”;
NarrateStrings[59] = “”;

function NextImage()

{

iImage += 1;

if ( iImage > LAST_IMAGE ) iImage = 1;

SwitchImage();

}

function PreviousImage()

{

iImage -= 1;

if ( iImage < 1 ) iImage = LAST_IMAGE;

SwitchImage();

}

function SwitchImage()

{

document.images[0].src = GetImageName(iImage);

WriteImageCount();

WriteNarrative();

}

function GetImageName(imageNum)

{

return “../images/Utah/deervalley/utah2004″+ imageNum + “.jpg”;

}

function WriteImageCount()

{

countString = iImage + ” of ” + LAST_IMAGE;

if ( document.all )

{

// MS IE4 or better

CountText.innerText = countString;

}

else if ( document.layers )

{

// Netscape crud

fontStart = “<p align=’center’><big><color=’#000000′>”;

fontEnd = “</big></p>”;

document.layers[“PositionLayer”].clip.width = document.width;

document.layers[“PositionLayer”].clip.height = 20;

document.layers[“PositionLayer”].left = -document.width/2 + 15;

document.layers[“PositionLayer”].document.layers[“CountLayer”].document.open();

document.layers[“PositionLayer”].document.layers[“CountLayer”].document.write(fontStart + countString + fontEnd);

document.layers[“PositionLayer”].document.layers[“CountLayer”].document.close();

}

}

function WriteNarrative()

{

narrateString = NarrateStrings[iImage – 1];

if ( document.all )

{

// MS IE4 or better

NarrateText.innerText = narrateString;

}

else if ( document.layers )

{

// Netscape crud

fontStart = “<p align=’center’><b><font face=’Arial’ size=’1′ color=’#000080′>”;

fontEnd = “</b></p>”;

document.layers[“NarrativeLayer”].clip.width = document.width;

document.layers[“NarrativeLayer”].clip.height = 20;

document.layers[“NarrativeLayer”].left = -document.width/2 + 15;

document.layers[“NarrativeLayer”].document.layers[“NarrateLayer”].document.open();

document.layers[“NarrativeLayer”].document.layers[“NarrateLayer”].document.write(fontStart + narrateString + fontEnd);

document.layers[“NarrativeLayer”].document.layers[“NarrateLayer”].document.close();

}

}

</script>
<p align=”center”><strong>Utah Pics</strong><br>
<big>Deer Valley</big></p>
<hr>

<div align=”center”>
<center>
<table border=”0″>
<tr>
<td align=”center” valign=”top”>
<img border=”1″ src=”../images/Utah/deervalley/utah20041.jpg”>
</td>
</tr>
<tr>

<td align=”center” valign=”top”>
<form method=”POST”>
<p>
<input type=”button” value=”&lt;&lt; Prev” name=”Prev” onClick=”PreviousImage();” style=”color: #000000; font-family: Arial; font-size: 8pt; font-style: italic; font-weight: bold”>
<input type=”button” value=”Next &gt;&gt;” name=”Next” onClick=”NextImage();” style=”font-family: Arial; color: #000000; font-size: 8pt; font-style: italic; font-weight: bold”>
</p>
</form>
</td>
</tr>

<tr>
<td align=”center” valign=”top”><b>

<p id=”CountText”></p>
<p id=”NarrateText”></b></td>
</tr>
<tr>
<td align=”center” valign=”top”><b>
<ilayer id=”PositionLayer” left=”-450″>

<layer id=”CountLayer”>
</layer>
</ilayer>
</b></td>
</tr>
<tr>
<td align=”center” valign=”top”><b>
<ilayer id=”NarrativeLayer” left=”-450″>

<layer id=”NarrateLayer”>
</layer>
</ilayer>
</b></td>
</tr>
</table>
<div align=”left”>
<p><br>
<br>
<big>Sunday, July 18</big> <br>
Slept horrible. Maybe 5 hours at the most. Assembled the bike with only one issue. The hydraulic brake lines had pressurized leaving my front brakes so tight I could barely wedge my front tire in between them. Not good. I knew that a full days worth of Downhill riding would wear the pads a little and the problem should be taken care of. Loaded up the pickup and went over to Cruisers and Tuckers hotel. Tucker got some deal where they gave him 2 rooms instead of one for the same price accidentally. We hit the local Denny’s and started the 35 minute drive towards Deer Valley resort. I am struck by how pretty Salt Lake City is. It is completely surrounded by mountains. No Mormon encounters yet. At least not that I know of. :-)</p>
<p> We arrive at Deer Valley thanks to the GPS(its so nice not traveling with any paper maps) and load up. I use one shin pad to cover my 2 huge bumps on my shin from 2 weeks ago. I never knew Rae could kick like that! One more hit and I’m done for the week. I look like I’m making some Michael Jackson Fashion statement.
We buy out lift tickets and take the lift up. It takes about 15 minutes to get up. We hit Aspen slalom trail and it is incredible. Technical with drops and tight switchbacks all the way down. Much better than Sun Valleys longer but non-technical DH runs. Unlike Sun Valley this place has multiple routes marked like ski trails that you can come down. Marked in degrees of difficulty(easy-expert) so you can weave your way down. We continue to hit run after run and save a 6 mile trail for last. This is some of the most awesome singletrack I have ever ridden. The views are amazing. It did involve some pedaling unlike the other runs but it was worth every stroke. The weather was perfect today. My luck must be changing. We pack up and head into Park City and grab some BBQ(again thanks to the GPS). Cool town but touristy as you’d expect any ski resort town to be. Headed back to SLC. Looked at pics taken during the day and there are some real good ones. Back at my trusty Motel 6 I am awakened by the stomping above me. I have the people from hell right above me. It is so bad I call and ask to be moved to another room upstairs. It’s a big hassle with bike, bike case, and 3 bags but I need to sleep! </p>
<p align=”center”><a href=”utah2.php”><img src=”../images/arrowright.GIF” alt=”next page” width=”25″ height=”15″ border=”0″></a><br>
<br>
<a href=”utahintro.php”>Utah Pics Main Page </a>

</p>
</div>
</center>
</div>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JAug 23.2004 — In the function

function SwitchImage()

this is the line of code that states which image src to change

document.images[0].src = GetImageName(iImage);

What you need to do is change the index number to reference the correct image tag

document.images[[B][COLOR=red]0[/COLOR][/B]].src = GetImageName(iImage);

or you could give the image tag a name and go

document.images["yourname"].src = GetImageName(iImage);
×

Success!

Help @moab spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...