Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Help Refreshing a Div
Old 03-08-2009, 01:00 AM Help Refreshing a Div
Junior Talker

Posts: 1
Trades: 0
Hi there,

I'm working on a website and I need it so that when you click a button the image changes inside a div to the next image in the list so to speak.

The code i've got for the div at the moment is:

Code:
<div id="image">
<script type="text/javascript">
var number2 = 1;
imagechange(number2)
</script>
</div>

This is the inside of "imagechange":
Code:
function imagechange(number)
{

var location="file:///C:/Documents%20and%20Settings/Administrator.TONY-P7Z66YC5R4/My%20Documents/Aarons%20website/Lynadell/pics/pic" + number + ".jpg";

document.write('<image src="' + location + '">');
}
Location is just the location of the pic. I have it so each picture has the same name "pic" and a difffernt number after so all that has to be done is add 1 and you have another pic.

This is the code that should change the div:
Code:
<image src="images/buttonright.jpg" onclick="javascript:
document.getElementById('image').innerHTML = 
number2++;
imagechange(number2);
">
This I thought should work but what happens it seems is that it works but it expands the div to fit the hole page and then just shows the next image in line. So is there anyway to stop it expanding the div? If not would there be a way to do what I want to happen?

Thanks Vromoth
Vromoth is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-08-2009, 08:06 AM Re: Help Refreshing a Div
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Wow, very convoluted! why not just preload the images and then copy them to a default image to change it.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help Refreshing a Div
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10422 seconds with 12 queries