Link to home
Start Free TrialLog in
Avatar of rdavis101
rdavis101

asked on

Weird scrolling problem

I just finished www.LasikMemorial.com, but one nagging issue remains. Go to www.LasikMemorial.com/Home.htm  Use Lazarus for the password. I wrote a small javascript routine that displays pictures whenever one of the thumbnails is clicked (the "thumbnail" is just an image displayed as the background of an anchor tag). Problem is, this causes the browser to scroll back to the top of the document. How can I fix it?  Just worried about IE here, not Netscape or Opera.

function ShowPageImages(iLeft, iTop, iWidth, iHeight, stPicture)
  {
  stPicture="url(" + stPicture + ")" ;
  iLeft = iLeft + document.body.clientWidth/2-385+200+3
  document.getElementById("ShowImagesDIV").style.left=iLeft ;
  document.getElementById("ShowImagesDIV").style.top=iTop ;
  document.getElementById("ShowImagesDIV").style.width=iWidth ;
  document.getElementById("ShowImagesDIV").style.height=iHeight ;
  document.getElementById("ShowImagesDIV").style.background=stPicture;
  document.getElementById("ShowImagesDIV").style.visibility="visible" ;
  }



Avatar of knightEknight
knightEknight
Flag of United States of America image

without looking, I'm guessing that you need to return false in the onclick of the link -- after you do what ever it is to show the bigger picture

<A  ...   onclick="showBigPic(); return false;" >
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
... where I have "showBigPic" above, I ofcourse meant "ShowPageImages"
Avatar of rdavis101
rdavis101

ASKER

Thanks guys...much appreciated!

Roger
You are welcome.