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

Getting a popup from an if

Status
Not open for further replies.

minignaz

Programmer
Jan 10, 2005
9
GB
Hello,

Im wanting a popup window to appear only if something has happened as soon as the page loads.
I dont want the user to press any buttons or anything.
Im developing an online calendar with events, and Im wanting the calendar to display a popup message if the current day has a scheduled event.

I have a variable that will be set if an event is happening that day, but I dont know how to get the message popup to appear (msgbox "" doesnt work) and I would like to use a custom created page for it (called notify.html).

Any help would be brilliant.

Cheers in advance.
 
where are you storing these scheduled events for each day? Are they in a database?

The client-side javascript to display a popup is alert("your message here"); - further Javascript help can be found in the Javascript forum (Forum216)


Tony
_______________________________________________________________
 
There stored in an access database, people go in an enter the info via the calendar itself, then the info is stored in the database. The system retrieves the info and displays it in a calendar display when loaded.
 
With the server side code you can write to the output buffer when a certain condition arises, this output could contain a client side script - for example your popup window.

Code:
<html>
	<head>
		etc etc
	</head>	
<%
	'Some Code etc here...
	dim sVar
	sVar = "123"
	
	if sVar = "123" then
		%>
			<script type="text/Javascript">
				alert('hello<%=sVar%>');
			</script>
		<%
	end if
%>
	<body>
		etc etc
	</body>
</html>

This is just a guide and will need to be adapted for your code, though should give you the idea.

If you want an actual browser window to appear rather than a dialog box, then use the window.open javascript function instead of alert

example here:
Also, just to add to Tony's note about choosing the right forum, you may want to do a search in future too - this url will get you google's results:


(if you add the keyword javascript the results are even better). All the keywords were in your post, so it makes sense to do a search first - and can bring you some very interesting results... instantly.

Hope that helps.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top