-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hiiii......
i m very new with ZK. i want to know about onLoad event in ZK
in HTML we can use <body Onload="XXX()">
in same way how can i call a function which is written in <zscript>
Please help me ASAP.
Thanks in advance.
ZK 3: http://docs.zkoss.org/wiki/Client_Side_Actions
ZK 5: http://docs.zkoss.org/wiki/ZK5:_Client_Computing_with_ZUML
What about this: http://docs.zkoss.org/wiki/Client_Namespace#Communicate_to_server
I m trying some code what ever u recommended but actually thing is that i want to call server side function from client event.
<zk>
<window contentStyle="background-image : url(image/panel.jpg)">
<html>
<body onload="auth()" onmousemove="timer = start" onclick="timer = start" onkeyup="timer = start" >
</body>
</html>
<script type="text/javascript">
<![CDATA[
var Auth;
function auth()
{
Auth = '${sessionScope.Authentication}';
if(Auth!="admin")
{
window.location = "timeout.zul";
}
else
{
countdown();
}
}
var start = 300;
var timer = start;
function countdown()
{
if(timer > 0)
{
timer -= 1;
setTimeout("countdown()",1000);
}
else
{
location.href="timeout.zul";
}
}
]]>
</script>
//code
<zscript>
</zscript>
</windows>
above code is working properly but their i ve used java script and HTML code.
but i think in java script we cant expire session attributes. so above code redirecting
page after five minutes. but when u ll press browser back button then again same page comes
because session in not expired and i m checking Authentication using session.
Thats y, In same way i want to write code in <zscript> but problem in onLoad event.
i think now u r able to get my requirements so please give me suggestions.
Thanks
Asked: 2010-04-13 02:54:59 +0800
Seen: 4,013 times
Last updated: Apr 14 '10