Refresh Image Button Needed (refreshes image only, not whole page) [fixed] |
Author: |
Message: |
prashker
Veteran Member
Posts: 5109 Reputation: 104
– / / –
Joined: Mar 2005
Status: Away
|
O.P. Refresh Image Button Needed (refreshes image only, not whole page) [fixed]
Right now I have code that when you refresh the page it changes the image automatically that is displayed.
Thing is I dont really like that as it restarts the music playing in the backround.
So,
How would I create a button, that when you click it, it automatically reloads the image without refreshing the whole page, just the image part of it.
quote: Nathan says:
it will probs use a cookie to track that they've enabled this, he also thinks you will have to use ajax.
Help ?
This post was edited on 04-21-2007 at 08:55 PM by prashker.
|
|
04-21-2007 06:39 PM |
|
|
MeEtc
Patchou's look-alike
In the Shadow Gallery once again
Posts: 2200 Reputation: 60
38 / /
Joined: Nov 2004
Status: Away
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
if the image is an <img> tag, something like this might work:
code: <input onclick="getimage()">
<script>
function getimage() {
document.getElementById(picture id name).src = 'path to random image generator php file'
}
</script>
If its a css background image, use something like this:
code:
<script>
function getimage() {
document.getElementById(picture id name).className = 'path to random image php file'
}
</script>
<script>
function getimage() {
document.body.style.backgroundImage = 'url(path to random image php file)'
}
</script>
This post was edited on 04-21-2007 at 07:11 PM by MeEtc.
I cannot hear you. There is a banana in my ear.
|
|
04-21-2007 06:52 PM |
|
|
Nathan
Veteran Member
Yeah, "large dimensions" ;)
Posts: 2984 Reputation: 76
– / /
Joined: Apr 2005
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
It is infact in the body tag: using a style.
|
|
04-21-2007 06:56 PM |
|
|
MeEtc
Patchou's look-alike
In the Shadow Gallery once again
Posts: 2200 Reputation: 60
38 / /
Joined: Nov 2004
Status: Away
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
body? ok, ill edit the script
EDIT: no, that doesn't quite work yet
This post was edited on 04-21-2007 at 07:04 PM by MeEtc.
I cannot hear you. There is a banana in my ear.
|
|
04-21-2007 06:57 PM |
|
|
Nathan
Veteran Member
Yeah, "large dimensions" ;)
Posts: 2984 Reputation: 76
– / /
Joined: Apr 2005
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
ah, yyou dont get sonicsam, he wants it to automatically update like a slideshow.
|
|
04-21-2007 07:03 PM |
|
|
prashker
Veteran Member
Posts: 5109 Reputation: 104
– / / –
Joined: Mar 2005
Status: Away
|
O.P. RE: Refresh Image Button Needed (refreshes image only, not whole page)
quote: Originally posted by Nathan
ah, yyou dont get sonicsam, he wants it to automatically update like a slideshow.
Ok let me say it again .
When you click a button like "Refresh this Image" it refreshes the image without reloading the whole page .
This post was edited on 04-21-2007 at 07:06 PM by prashker.
|
|
04-21-2007 07:05 PM |
|
|
MeEtc
Patchou's look-alike
In the Shadow Gallery once again
Posts: 2200 Reputation: 60
38 / /
Joined: Nov 2004
Status: Away
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
no, he says: quote: Originally posted by SonicSam
How would I create a button, that when you click it, it automatically reloads the image
if you want a slideshow, all you need to do is add the getimage() to the body onload and add a timer
This post was edited on 04-21-2007 at 07:06 PM by MeEtc.
I cannot hear you. There is a banana in my ear.
|
|
04-21-2007 07:05 PM |
|
|
vaccination
Veteran Member
Posts: 2513 Reputation: 43
32 / / –
Joined: Apr 2005
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
=s
He just wants a button that when you click reloads the php file - well that's my understanding anyway.
|
|
04-21-2007 07:06 PM |
|
|
prashker
Veteran Member
Posts: 5109 Reputation: 104
– / / –
Joined: Mar 2005
Status: Away
|
O.P. RE: Refresh Image Button Needed (refreshes image only, not whole page)
quote: Originally posted by MeEtc
if you want a slideshow, all you need to do is add the getimage() to the body onload and add a timer
Nononono.
quote: Originally posted by vaccination
=s
He just wants a button that when you click reloads the php file - well that's my understanding anyway.
. Basically.
So let me explain it 1 more time.
http://jesuswasajew.info/
See it plays music and shows a random image?
When you refresh the page, the image changes, but the music restarts, because the whole page was refreshed.
I want a button, that when you click it, changes ONLY the image, and does not refresh the whole page.
Ok ?
This post was edited on 04-21-2007 at 07:12 PM by prashker.
|
|
04-21-2007 07:07 PM |
|
|
andrewdodd13
Senior Member
Oh so retro
Posts: 870 Reputation: 16
34 / /
Joined: Jan 2005
|
RE: Refresh Image Button Needed (refreshes image only, not whole page)
You could always use... *cough* frames *cough*.
|
|
04-21-2007 07:37 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|