-
Window.alert script problem/question
I would like a script that prompts an alert after visitors click to view a large video file (the "Play PDM Montage Clip" link) at:
www.pdmdigital.com/slideshows.htm
The script that I wrote looks like this:
function loadtime()
{window.alert("Please be patient as this clip is a large file. Thanks, PDM")
setTimeout("loadtime()", 1500)
}
There are a few problems. First, for some reason the function is called when you click on the "Photo Montages/Slideshows" link from any of the four pages, not just the 'Play' link where the function is called from the onClick event handler.
Second, it keeps popping up repeatedly. The reason I attempted to put in a timeout is so that Windows Media Player (or whatever media player) would pop up first and begin buffering, THEN the alert would pop up and say please be patient. Any and all help is truly appreciated, thanks much for reading this, theMind-
-
-
Your first problem is an illusion, as the function must still be running, try it without ever clicking on the link for 'Play' in the first place, no problem. The second problem is due to a misunderstanding on your part (I think) of what setTimeout means. It means, wait for (in this case) 1.5 seconds and do whatever is quoted in the first part of the parenthesis. So, the way you have it, every time the script runs to its end, it sets a call to run itself again in 1.5 seconds. This is exactly what is happening. Fortunately, while the alert is showing, script functions are paused, or it would be very hard to break out of the loop that you've created without ending the browser program using taskmanager. Just get rid of the setTimeout and it should be fine.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks