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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup window and ASP

Status
Not open for further replies.

TPetersonFlorida

Programmer
Aug 8, 2003
76
US
I have a frame that automatically refreshes every 5 seconds. i want to put some asp code on it to check a database for a message and if found popup a window w/ that message in it with the ability for the user to respond to it. the popup window code is a javascript function, how can i call this from asp? or is there a better way of doing this?

thanks in advance!!!!
 
Here's an example using vbscript. I'm sure you can replace it with javascript and it will work as well. You query the db on each refresh, correct? If a certain criterial is met you want the popup. What happens here is that if the condition is met I force the execution through a patch of client-side script that opens a new window.

Set Conn = Server.CreateObject("Adodb.Connection")
Conn.open myConnString
strSql = "SELECT YourColumn FROM tbl_YourTable WHERE YourColumn = Whatever"
set rs=Conn.execute(strSql)
if not rs.eof then%>
<script language=&quot;vbscript&quot;>
strOptions = &quot;toolbar=No, location=no, directories=no, &quot;
strOptions = strOptions & &quot;status=no, menubar=no, scrollbars=yes, &quot;
strOptions = strOptions & &quot;resizable=Yes, width=350, height=300&quot;
Window.Open &quot;YourPopupPage.asp&quot;,&quot;myNewWindow&quot;,strOptions
</script>
<%end if
set rs=nothing
conn.close
set conn=nothing
%>
 
Thanks Veep, that worked! Another question though, is there any way to see if the popup window is already open?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top