DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   want to remove href="#" from JavaScript Function link (http://www.daniweb.com/forums/thread165186.html)

bimaljr Dec 31st, 2008 6:05 am
want to remove href="#" from JavaScript Function link
 
Hi
I have an Image Gallery on my site. When a user click on thumbnail image, a JavaScript function will load/change image on the imageView area.

Here is the JS function :
<SCRIPT language="JavaScript">
function changeimage(img_name,img_src) {
document[img_name].src=img_src;
}
</SCRIPT>

Here is the ImageView area code :
<IMG NAME="imageloader" SRC="image_1051.jpg" ALT="Image">

Here is the link code :
<A HREF="#"  onclick="changeimage('imageloader','image1.jpg')" >link</A>
<br>
<A HREF="#"  onclick="changeimage('imageloader','image2.jpg')" >link</A>
<br>
<A HREF="#"  onclick="changeimage('imageloader','image3.jpg')" >link</A>

Now come to my problem :
I wan to remove HREF="#" from the link code, because when anyone click on any link, the goes to top of page, and my Image Gallery is at center position of page.

Is there any way to remove the HREF="#" ? Or disable the page scrool ?

Help me please

Thank you

bimaljr Dec 31st, 2008 6:09 am
Re: want to remove href="#" from JavaScript Function link
 
Hey

The problem is solved :)
I have changed the link code.

Old Code :
<A HREF="#"  onclick="changeimage('imageloader','image1.jpg')" >link</A>

New Code :
<A HREF="#"  onclick="changeimage('imageloader','image1.jpg'); return false;" >link</A>


All times are GMT -4. The time now is 7:14 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC