View Full Version : Need two JavaScripts, maybe the search's over?

01-10-2003, 09:30 PM
Hi, I'm trying to find these JavaScrips, but it's harder then I thought. :(
Appreciate it if anyone in here could point me thorward two JavaScrips wich does something like this:

Mask the url address (from http://www.telia.se/~4024024024 to just http://www.simple.org)


Reloading an image, just the image, not the hole page. (the script should allow me to determain patch to the image, and delay on when it should reload)

Anyone who answers this and by some mean can help me out, BIG thanks! :thumbsup:

Love ya :D

01-10-2003, 09:51 PM
Ok. Javascript won't be able to mask the URL like that. You'd need to customize Apache to achieve that.

About your images reloading? Hmmm, this should work...
function reloadImage( time, imgId )
setTimeout( "document.images[imgId].src = document.images[imgId].src", time );
}Note that in javascript the time parameter is in milliseconds, so a 3 second delay would be 3000

01-10-2003, 10:29 PM
I wrote this


function reloadImage( 5000, )

"document.images[].src =

document.images[].src", 5000 );

My image's located over at

...nothing showed, I'm pretty sure I did something wrong.

Anyone correct this for me, caus I don't know how too.

01-10-2003, 10:38 PM
You've got the wrong idea.
<script type="text/javascript">
function reloadImage( time, imgId )
setInterval( "document.images[imgId].src = document.images[imgId].src", time );

<body onload="reloadImage( 5000, 'camPic' );">

<img src="" id="camPic">

</html>This will refresh the image EVERY five seconds.

01-10-2003, 11:00 PM
So far so good.
The image appears.

But only once.

The page tries to reload after 5 secounds, but then, down there on the IE status bar, it says something like "Error on page" and the same picture's shown.

It'll reload tho normal when I push the regulair reload-button.

Seems good this far, now, on how to fix that... does it work ok for you? You can see my test-page over at here (http://home.no/philipshemsida/TEST.html) and tell me how it went.

Thanks dude for your help by the way, very appreciated. :thumbsup:

01-10-2003, 11:08 PM
Sorry, I forgot those intervals need global variables...
function reloadImage( time, imgId )
window.myImage = document.images[imgId];
setInterval( "myImage.src = myImage.src", time );

01-10-2003, 11:50 PM
Seems to be running fine now... I'll just implant it into my homepage and we'll see soon...

01-11-2003, 01:33 AM
The code worked perfectly.

Thank you beetle very much, you've been to great help.

The JavaScript's updating my webcam pictures, and without reloading the hole page, exactly as I wanted it... sure rocks! :D