You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Sapounov Alexey <sa...@gmail.com> on 2008/12/04 16:56:44 UTC

Re: When page is onload, can Ajax Modal window be loaded?

Sorry for my english...

For me, I found the solution:

This works for me because I haven't any links on my page

1. Create na AjaxLink for show modal window.
2. Set the CSS attribute visibility to hidden (we don't need a click by
mouse to that link :) )

3. Use JavaScript for "click" this link:
3.1 - search the links on page :
     var linksOnpage = document.getElementsByTagName("A");
     var showModalLink = document.getElementById(linksOnPage[0].id);

3.2 - "click" the link
    showModalLink.onClick();

that's all :)

4. Don't forget to add "onLoad" to <body> tag


--------------------
<body onLoad="showModal">

<script>

function showModal(){
     var linksOnpage = document.getElementsByTagName("A");
     var showModalLink = document.getElementById(linksOnPage[0].id);
     showModalLink.onClick();
}

</script>



    

or shorter:


function showModal(){
     var showModalLink =
document.getElementById(document.getElementsByTagName("A")[0].id);
     showModalLink.onClick();
}

-- 
View this message in context: http://www.nabble.com/When-page-is-onload%2C-can-Ajax-Modal-window-be-loaded--tp10927996p20836349.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.