spacer
Yehuda Shiran October 9, 2001
Positioning Popup Windows
Tips: October 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

One easy way to create tool tips is by using the popup window. You can control its size, location, style, and innerHTML. You can use its style object to specify the backgroundColor, border, fontSize, and fontFamily. You can also specify an element on the page to which you reference the x and y coordinates. Try this popup window. Find it somewhere in the upper left corner of your document. Click anywhere to get rid of the popup window. The reference element is the following text:

Reference the popup window to here.

Here is how we define this element:

<DIV ID="putHere">
Reference the popup window to here.
</DIV>
Here is the code that prepares the popup window object:

<SCRIPT LANGUAGE="JavaScript">
<!--
var oPopup = window.createPopup();
oPopupBody = oPopup.document.body;
oPopupBody.innerHTML = "Hello There";
oPopupBody.style.backgroundColor = "#ffff66";
oPopupBody.style.border = "1 solid black";
oPopupBody.style.fontSize = "12px";
oPopupBody.style.fontFamily = "Courier New";
// -->
</SCRIPT>
And here is how we call it in the above "Try" link:

  oPopup.show(100, 200, 100, 20, putHere);
You prepare the object off line, as shown above, and then display it with the show() method. This method has four mandatory parameters, and one optional (reference-element):

  show(x-location, y-location, width, height, reference-element);
The coordinates are relative to the reference element putHere.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business