Hi

This is my 1st attempt at a website, which I'm writing for someone as a surprise. I am using microsoft office live as the platform for my website. what I've attempted is find a picture layout I liked from another website and copied the relevant code, replacing thier website/pic name with my own (see below). However, It doesnt work properly as the main image (image 1) doesnt change when I click on image 2. Does anyone know why and how to fix this?Alternatively some different code? Please keep it really simple, as I'm a bit clueless.

Thanks, Richard

This is the code in its entireity-

div id="maincontent"><!--Start Main Content Area--><!-- Start Main Content Column -->
        <div id="horse_detail">
            <h1>Squirt - Thorneyside Intruder</h1>
            <div id="image">
                <img id="large_image" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="Main image of Stallion" title="Main image of the Stallion" width="620" height="400" />             </div>
            <div id="thumbs">
                
<a href="#image1"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/p1000250.jpg')"><img id="thumb1" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="first small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>
                
<a href="#image2"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/picture 1181.jpg')"><img id="thumb2" src="http://brightsidewelshcobs.co.uk/images/picture 1181.jpg" alt="second small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>

<div id="horse_data">
         
                    <b>Name: </b>Squirt</div>
                    <b>Height: </b>15 HH</div>
                    <b>Age: </b>3</div>

Recommended Answers

All 3 Replies

and copied the relevant code, replacing thier website/pic name with my own

You realise nearly all website code is copyright and your 'Supprise' could be a fine?
Also the function imgSwap() is not shown, please send your JS code as well as your HTML

You realise nearly all website code is copyright and your 'Supprise' could be a fine?
Also the function imgSwap() is not shown, please send your JS code as well as your HTML

Hi

I dont understand, this is the only code I have?
imgSwap is shown twice, but im not sure this is the function that is the problem.

div id="maincontent"><!--Start Main Content Area--><!-- Start Main Content Column -->
        <div id="horse_detail">
            <h1>Squirt - Thorneyside Intruder</h1>
            <div id="image">
                <img id="large_image" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="Main image of Stallion" title="Main image of the Stallion" width="620" height="400" />             </div>
            <div id="thumbs">
                
<a href="#image1"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/p1000250.jpg')"><img id="thumb1" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="first small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>
                
<a href="#image2"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/picture 1181.jpg')"><img id="thumb2" src="http://brightsidewelshcobs.co.uk/images/picture 1181.jpg" alt="second small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>

<div id="horse_data">
         
                    <b>Name: </b>Squirt</div>
                    <b>Height: </b>15 HH</div>
                    <b>Age: </b>3</div> div id="maincontent"><!--Start Main Content Area--><!-- Start Main Content Column -->
        <div id="horse_detail">
            <h1>Squirt - Thorneyside Intruder</h1>
            <div id="image">
                <img id="large_image" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="Main image of Stallion" title="Main image of the Stallion" width="620" height="400" />             </div>
            <div id="thumbs">
                
<a href="#image1"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/p1000250.jpg')"><img id="thumb1" src="http://brightsidewelshcobs.co.uk/images/p1000250.jpg" alt="first small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>
                
<a href="#image2"  onclick="imgSwap('http://brightsidewelshcobs.co.uk/images/picture 1181.jpg')"><img id="thumb2" src="http://brightsidewelshcobs.co.uk/images/picture 1181.jpg" alt="second small image of stallion" title="click to view this image of the horse" width="100" height="75" /></a>

<div id="horse_data">
         
                    <b>Name: </b>Squirt</div>
                    <b>Height: </b>15 HH</div>
                    <b>Age: </b>3</div>

There is no javascript in that code, just a call to a javascript program you are not showing.. There has to be another file with a .js extension containing the javascript code, plus code in the head of the html code to tell the browser where to find the file.

If you stole this code from another website (violating the owner's copyright), you did not also get the javascript file. The page will not work without it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.