[Javascript] How to separate the href

Hassan Schroeder hassan at webtuitive.com
Thu Aug 11 10:28:39 CDT 2005


Scott Moore wrote:

> since it worked in the script I originally started with
> function showPic (whichpic) {
>     if (document.getElementById) {
>         document.getElementById('placeholder').src = whichpic.href;
>         return false;
>         } else {
>         return true;
>     }
> }
> 
> However, that's not the case and the image href acts like a normal link.
> 
> Any suggestions?

This:

    <a onclick="showPic(this)" href="img01.jpg"></a>

should be:

   <a onclick="return(showPic(this))" href="img01.jpg"></a>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the Javascript mailing list