> "I Osman" <os*****@dircon.co.uk> wrote:
news:os***************************@news.ndo.com... .
In article <Rw**************@newssvr17.news.prodigy.com>,
"BootNic" <Bo*****@bounce.prodigy.net> wrote:
<script type="text/javascript">
function showPic (whichpic) {
var a=(document.getElementById)?false:true;
if (document.getElementById) {
document.getElementById('picswap').src = whichpic.href;
document.getElementById('desc').childNodes[0].nodeValue=
(whichpic.title)?whichpic.title:whichpic.childNode s[0].nodeValue;
}
return a;
}
function correction(){
document.getElementById('picswap').style.display=' none';
document.getElementById('picswap').style.display=' ';
}
</script>
<img id="picswap" src="images/bit.gif" alt=""
onload="correction()" />
site:
http://www.lisavallentin.com/sketches.html
Hi,
I did use this amended code in the .js file and xhtml.
The onload="correction()" part in the link does not validate and the
image loading problem (takes a double click to bring the image to
the front) still persists. I going back to my original flawed
method.
Is there a way to do this all in the .js file and not in the html.
It should be possible to get the javascript to only be applied to
links class="showme" for example.
Strange that onclick="" would validate xhtml and onload="" doesn't.
The onload="correction()" is the part that redraws the node to
correct the display issue Mozilla has, you should get the same result
with one click if you Minimize and Maximize the browser.
The showPic function did the same thing, just wrote different.
Try this in your script.js and see if it will do what you want.
function showPic (whichpic) {
var a=(document.getElementById)?false:true;
var b = whichpic.href.split('/');
if (document.getElementById) {
document.getElementById('picswap').src = whichpic.href;
document.getElementById('desc').childNodes[0].nodeValue=
(whichpic.title)?whichpic.title:b[b.length-1];
}
return a;
}
function correction(){
document.getElementById('picswap').style.display=' none';
document.getElementById('picswap').style.display=' ';
}
function loadcorrection(){
if(window.addEventListener && document.getElementById('picswap')){
document.getElementById('picswap').addEventListene r("load", correction, false);
}
}
if(window.addEventListener){
window.addEventListener("load", loadcorrection, false);
}
--
BootNic Wednesday, December 21, 2005 11:20 AM
You can discover what your enemy fears most by observing the means he uses to frighten you.
*Eric Hoffer*