treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Javascript Code Help

  • I have already posted a discussion about this issue but no one seems to know whats wrong. So i post it again hoping that someone new can see this post and help me out. I'm having an issue with a JavaScript image pop-up were the website scrolls down automatically when the close button is clicked for the pop-up. I still don't know what the issue is and i hope someone can help me.

    To see the issue visit this WEBSITE and click on the "Drawings" section. Then click on the first image which is batman. A pop-up would show up. Then click the "Close" button and see how the page scrolls down just a bit.

    HERE you can see the source code of the javascript pop up and see whats wrong with it. Thank you.

    Either a solution or an alternative method to doing this would be appreciated.

  • I can't reproduce this. What browser?

  • I see the problem. Definitely has to do with the hash in the anchor tag:

      <a href="#" onclick="popup('popUpDiv')" id="closebox">X</a>
    

    If you simply change that to a span, no more problem:

      <span onclick="popup('popUpDiv')" id="closebox">X</span>
    

    You'll need to update the styles for it, though.

    As a side note: you'll have a lot easier of a time managing the website if you kill those iFrames.

  • @TheDoc

    +100 For you sir. Thank you.