/    Sign up×
Community /Pin to ProfileBookmark

newbie needs help please

I have built a simple one page web site in html with the help of a mate via numerous e-mails. The page is just text and photographs. My mate has suggested inserting javascript to make the photos appear in random order each time the page is opened, very clever I thought. He’s sent me three files for reference together with the actual code.
Although he has tried several times to explain it to me and I have made lots of attempts I cannot get the code to work.
The code just appears on the web page after I have saved it.

He said to insert this at the top of the page

<script language=”JavaScript” type=”text/javascript”
src=”js/BildPopUp.js”></script>

and to put this above the photographs

<a title=”Image” alt=”Image”
href=”javascript:popImage(‘Image.jpg’,’Image.jpg’)”><img border=’0′
src=’Image.jpg’ width=”160″ height=”210″></a>

Sorry to rabbit on so much.
Thanks for any suggestions.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJan 21.2008 — Give this a try

[CODE]<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<script type="text/javascript">

image = ["pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg"]

function showImg(){
index = Math.floor(Math.random() * image.length)
document.rdm_img.src=image[index]
}

// add onload="showImg()" to the opening BODY tag

//-->
</script>

</HEAD>
<BODY onload="showImg()">

<img src="" name="rdm_img">


</BODY>
</HTML>[/CODE]
Copy linkTweet thisAlerts:
@smokeyoneauthorJan 22.2008 — Thanks for the help but no success yet. I wonder if I am inserting the code in the incorrect place.

I placed it directly beneath the document title.
×

Success!

Help @smokeyone 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.7,
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,
)...