dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: JavaScript
Expertise: Intermediate
Jun 20, 2003

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


A Flying Pop-up Window

The following code can be used to create a popup window which flies in the screen.

<html>
<head>
<SCRIPT LANGUAGE="JavaScript" type="text\JavaScript">
var popUp = 0;
var popURL = 0;
var popWidth = 0;
var popHeight = 0;
 
var thisMargin = 20;
 
var popTopPosition = thisMargin;
var popLeftPosition = thisMargin;
 
var pause = 20;
var step = 10;
var timer = 0;
 
var screenWidth = 0;
var screenHeight = 0;
 
var endX = 0;
var endY = 0;
 
//test undo
 
function startPop(thisurl,thiswidth,thisheight) {
 popURL = thisurl;
 popWidth = thiswidth;
 popHeight = thisheight;
 
 popUp = window.open(popURL,'traveler','toolbar=no,width=+popWidth+,
height=+popHeight+,top=+popTopPosition+,left=+popLeftPosition');
 
 screenWidth = window.screen.width;
 screenHeight = window.screen.height;
 endX = screenWidth - thiswidth - thisMargin;
 endY = screenHeight - thisheight - thisMargin;
 movedown();
}
 
function movedown() {
 if (popTopPosition <= endY - 50) {
  popUp.moveTo(popLeftPosition,popTopPosition);
  popTopPosition += step;
  window.setTimeout("movedown()",pause);
 }
 else {
  clearTimeout(timer);
  popTopPosition = endY - 50;
  popUp.moveTo(popLeftPosition,popTopPosition);
  window.setTimeout("moveright()",pause);
 }
}
 
function moveright() {
 if (popLeftPosition <= endX) {
  popUp.moveTo(popLeftPosition,popTopPosition);
  popLeftPosition += step;
  window.setTimeout("moveright()",pause);
 }
 else {
  clearTimeout(timer);
  popLeftPosition = endX;
  popUp.moveTo(popLeftPosition,popTopPosition);
  window.setTimeout("moveup()",pause);
 }
}
 
function moveup() {
 if (popTopPosition >= thisMargin) {
  popUp.moveTo(popLeftPosition,popTopPosition);
  popTopPosition -= step;
  window.setTimeout("moveup()",pause);
 }
 else {
  clearTimeout(timer);
  popTopPosition = thisMargin;
  popUp.moveTo(popLeftPosition,popTopPosition);
  window.setTimeout("moveleft()",pause);
 }
}
 
function moveleft() {
 if (popLeftPosition >= thisMargin) {
  popUp.moveTo(popLeftPosition,popTopPosition);
  popLeftPosition -= step;
  window.setTimeout("moveleft()",pause);
 }
 else {
  clearTimeout(timer);
  popLeftPosition = thisMargin;
  popUp.moveTo(popLeftPosition,popTopPosition);
 }
}
</SCRIPT>
</head>
</html>
<body onload=startPop('FlyWindow.htm','400','300');>
</html>
M.V. Prem
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date