?
Solved

Make a browser close after n seconds

Posted on 1998-04-18
4
Medium Priority
?
160 Views
Last Modified: 2006-11-17
Make a browser close after n seconds can someone give me the script for it and
how to make a new window open when a user double click but when a user clicks
once it doesent do anything please the code for both of them.
0
Comment
Question by:Marc1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
Christian_Wenz earned 4000 total points
ID: 1265086
you cannot always close the whole browser, but you can close a browser window in n seconds:
<SCRIPT LANGUAGE="JavaScript"><!--
  setTimeout("self.close()", n)
//--> </SCRIPT>

A doubleclick is only recognized with netscape Communicator 4; however here's a trick that does something when you click twice on a button:

<INPUT TYPE="BUTTON" VALUE="doubleclick me" onClick="test()">

and the function test looks like this:

var count = 0
function test(){
  count++
  if (count==2){
   var MyWin = new window()
   MyWin.open("newwindow.html")
  } else setTimeout("count--", 500)
}

so the user has 500 milliseconds to click twice on the button, otherwise the counter is set back.

If you have questions about this, please leave me a comment here, I'll try to answer asap. :-)
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1265087
Wow!
0
 

Author Comment

by:Marc1
ID: 1265088
Thanks alot
with the double click is there a way to instead of a button i couls put a link?
0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1265089
if you let the link point to the JavaScript function (HREF="JavaScript:functionname()"), it should be possible...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question