laPistola Posted June 23, 2009 Share Posted June 23, 2009 i taken this script from http://www.alistapart.com/articles/imagegallery which when i try it it dont work, when you click the link it reloads a new page only containing the picture? whatis should do is replace a current large picture with another already on the page. my scripts <script type="text/javascript" language="javascript"> function showPic (whichpic) { if (document.getElementById) { document.getElementById('placeholder')» .src = whichpic.href; if (whichpic.title) { document.getElementById('desc')» .childNodes[0].nodeValue = whichpic.title; } else { document.getElementById('desc')» .childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue; } return false; } else { return true; } } </script> the code its using is <img id="placeholder" src="images/1.jpg" alt="" width="350" /> <p id="desc" class="style2">Click on an images to enlarge</p> and the links look like <a href="1.jpg" title="Click on an images to enlarge" onclick="return showPic(this)"><img src="1.jpg" width="75" /></a> i dont really what the title and desc bits so removed them but put hem back in when the script didnt work. i guess its just returning true but any ideas to why its not working?? Thank you Link to comment https://forums.phpfreaks.com/topic/163433-solved-image-gallery-problem/ Share on other sites More sharing options...
laPistola Posted June 24, 2009 Author Share Posted June 24, 2009 scrapped, just used my own code, works fine! function changePic(img) { document.getElementById('lPic').innerHTML = "<img src=\""+img+"\" wedith=\"350\" />"; return false; } Link to comment https://forums.phpfreaks.com/topic/163433-solved-image-gallery-problem/#findComment-862538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.