Evertjan. wrote:
> DoomedLung wrote on 02 feb 2006 in comp.lang.javascript:
> >
> > Hey, sorry for the inconvenience..I'm new to usenet.
> >
> > Ok at the moment I'm in the middle of writting a script that rewrites
> > a html page from an event handler that supplies the image url and
> > title for the page. Once the user fires the event in Firefox the
> > functionality works fine until the user presses the Reload button then
> > the dynamic image disappears!
> >
> > Now I gather as much that it's not displaying the image because the
> > image doesn't actually exsist... so I'm kinda stuck on dealing with
> > the reload issue in FireFox. here is the code:
> >
> >
> > function largeImg(imgSrc, title){
> > var w = window;
> > var d = w.document;
> > d.write('<html><head><title>'+title+'</title>');
>
> Why would you want to write a new clientside dynamic page?
> And why not the onclick in the <img> itself?
> And why not use css all over?
>
> Much better, in my view, is to make use of the DOM,
> redesign the page
> and fill an existing img with a new picture, like:
>
> ======================
> <img id='pic' style='display:none;'>
>
> <div id='tit'></div>
>
> <img src="imgs/tgpA/thumbs/thumb1.jpg" onClick=
> "largeImg('imgs/tgpA/large/large1.jpg','Document Ten')"
> style ='width:90px;height:120px'
> id='thumb'>
>
>
> ..<script...
> function largeImg(imgSrc, title){
> var pic = document.getElementById('pic')
> var thumb = document.getElementById('thumb')
> var tit = document.getElementById('tit')
> pic.src = imgSrc
> window.title = tit.innerHTML = title
> document.body.style.backgroundColor = 'navy'
> document.body.style.color = 'yellow'
> pic.style.display = 'block'
> thumb.style.display = 'none' // if you wish
> }
> ======================
>
> not tested
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Hey dude, thanks for the advice and your speedy response...
Now that you mentioned the DOM I don't why I didn't think of it in the
first place...
Cheers

]