Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Variable To Close function

Status
Not open for further replies.

FontanaS

Programmer
May 1, 2001
357
US
I have the following code that uses javascript to close a window. -

<td align="right"><a href="javascript:void(0)" onclick="window.opener=self;window.close();"><font face="Tahoma" color="#000080" size="4"><b>Close</b></font></a></td>

The problem is that I want to add -
Session("CanEdit") = "False" so it changes the value of the session variable when it closes. Otherwise I am stuck with that value when the user opens the form again.
 
that is ASP. ASP runs on the server, while javascript runs on the client.

maybe what you can do is have that link bring you to another page, which simply sets the session variable, then uses the onload event of the body tag to close the window.



*cLFlaVA
----------------------------
[tt]( <P> <B>)[sup]13[/sup] * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
I tried the following but still get an "object required" error -

<!--FUNCTION TO RESET THE SESSION VARIABLE-->
<script language="javascript">
function changevalue()
{
<%=Session("CanEdit")%> = 'False';
}
</script>
 
which i would expect. my first suggestion will work for you. create a new ASP page, with this simple information:

Code:
<%
Session("CanEdit") = False;
%>

<html>
  <head><title></title></head>
  <body onload="window.close();"></body>
</html>

have your link be this:

Code:
<a href="mynewpage.asp">

now, can you see why this is ASP, and not a Javascript solution?



*cLFlaVA
----------------------------
[tt]somebody set up us the bomb![bomb][/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top