Hi!
I would like to show a popup window when I click on a link. For some reason, this does not work. But it works when I call this function on a onMouseOver event for a link. Strange...
So, this works fine:
<a href='#' onMouseOver='popup( "workout",1 );' class='weekCalendarLink' id='entry_1_1'>9:30<br>Workout</a>
This does not work:
<a href='#' onClick='popup( "workout",1 );' class='weekCalendarLink' id='entry_1_1'>9:30<br>Workout</a>
Do you know why or how I could solve this problem? The live page can be found at http://www.get-up-fitness.de/wintercourseplan.aspx .
Thanks!
Show popup window with a JavaScript onClick call
For everybody who has the same problem and does not want to wait for the answer, this can be used as a workaround:
function initPopup( menuName )
{
setTimeout( "showPopup('" + menuName + "')", 1 );
}
function showPopup( menuName )
{
popup( menuName, 1 );
}
<a href='#' onClick='initPopup( "workout" );' class='weekCalendarLink' id='entry_1_1'>9:30<br>Workout</a>
function initPopup( menuName )
{
setTimeout( "showPopup('" + menuName + "')", 1 );
}
function showPopup( menuName )
{
popup( menuName, 1 );
}
<a href='#' onClick='initPopup( "workout" );' class='weekCalendarLink' id='entry_1_1'>9:30<br>Workout</a>
Hi,
What's happeing is the page is being reloaded because of the href=# bit when you click on the link. The menu is probably showing up but it gets refreshed so you never see it.
You need to replace the href="#" with href="javascript:popup('yourmenu','yourimage')" - This will mean that the link is the javascript popup function executor rather than an actual lnk.
Hope this helps,
Andy
What's happeing is the page is being reloaded because of the href=# bit when you click on the link. The menu is probably showing up but it gets refreshed so you never see it.
You need to replace the href="#" with href="javascript:popup('yourmenu','yourimage')" - This will mean that the link is the javascript popup function executor rather than an actual lnk.
Hope this helps,
Andy