BriCode Thoughts from Brian Holt

17Sep/110

Javascript pop-up won’t reopen or refocus when I click on the link.

This one is a bit of a tricky one, especially if you are not primarily a Javascript developer and not intimately familiar with its inner workings. The issue arrises when you create a Javascript pop-up window, close it, and then try to open it again. Or when you create a pop-up focus on something else, and the click on the link trying to refocus on the same window and nothing happens. At least for me, this was a pretty big "What the hell?" kind of moment because I have lots of pop-up windows with Javascript and never have had a problem before. What changed?

If you having these symptoms, your problem was likely mine. You likely have named your pop-up window function and your pop-up window var the same thing. In my case, I creatively named them both "popUp" and it turns out in Javascript this a no-no. Normally it's just not a good idea but it still works but as it turns out, in Javascript this actually will create issues. Javascript removes the pointer to the function and points to it to the window thus disconnecting you from the ability to call that particular function. Lame, right? Well, that's how it is so I suppose we should get better in our naming schemes. Hope that helps. Feel free to pose questions.

Comments (0) Trackbacks (0)

No comments yet.


Comments are closed.

No trackbacks yet.