want to remove href="#" from JavaScript Function link

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved

Join Date: Oct 2006
Posts: 42
Reputation: bimaljr is an unknown quantity at this point 
Solved Threads: 0
bimaljr bimaljr is offline Offline
Light Poster

want to remove href="#" from JavaScript Function link

 
0
  #1
Dec 31st, 2008
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 :
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <SCRIPT language="JavaScript">
  2. function changeimage(img_name,img_src) {
  3. document[img_name].src=img_src;
  4. }
  5. </SCRIPT>

Here is the ImageView area code :
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <IMG NAME="imageloader" SRC="image_1051.jpg" ALT="Image">

Here is the link code :
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <A HREF="#" onclick="changeimage('imageloader','image1.jpg')" >link</A>
  2. <br>
  3. <A HREF="#" onclick="changeimage('imageloader','image2.jpg')" >link</A>
  4. <br>
  5. <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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 42
Reputation: bimaljr is an unknown quantity at this point 
Solved Threads: 0
bimaljr bimaljr is offline Offline
Light Poster

Re: want to remove href="#" from JavaScript Function link

 
0
  #2
Dec 31st, 2008
Hey

The problem is solved
I have changed the link code.

Old Code :
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <A HREF="#" onclick="changeimage('imageloader','image1.jpg')" >link</A>

New Code :
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <A HREF="#" onclick="changeimage('imageloader','image1.jpg'); return false;" >link</A>
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC