hussainian Posted September 8, 2010 Report Share Posted September 8, 2010 (edited) Hi!I want to do something like thissetTimeout('<%session.removeAttribute("att");%>',20000)this things gives error.Alternatively, I defined a JavaScript function, and in that, did that session remove thing, likefunction removeAtt(){ <%session.removeAttribute("att");%>}setTimeout('removeAtt()',20000)In this case, attribute is removed without timeout.Even in the following case, alert appears at the given time, but remove statement executes without timeout interval.function removeAtt(){ <%session.removeAttribute("att");%>}setTimeout('removeAtt(),alert(\'This is alertt\')',20000)Any help!!!Thanks & Best Regards.Muhammad Asad Ullah Edited September 8, 2010 by Muhammad AsadUllah Bhatti Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2010 Report Share Posted September 8, 2010 You need to understand that server-side code is completely independent from the client-side code. It runs before the page gets sent to the browser.Look at the source code of your page after it gets sent. It would look like this: setTimeout('',20000) Or like this: function removeAtt(){}setTimeout('removeAtt()',20000) It's because the session.removeAttribute() function doesn't print anything. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now