hussainian Posted September 8, 2010 Share Posted September 8, 2010 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 Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2010 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
Archived
This topic is now archived and is closed to further replies.