Creating a floating window

Q: How can I create a floating window on my HTML page?

A: Here is a functional JavaScript code which you can use for creating the floating window. It was tested successfully in IE6, Mozilla/Firefox, Opera 7.54 (Windows), Safari, Mozilla (Macintosh). Download this .JS file and include it into your HTML page as it is shown below:

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1250″>
<title>Floating Window</title>
<script src=”Drag.js”></script>
</head>
<body>

…….

</body>
</html>

The code for the floating window is given below.

<div id=”window” style=”position:absolute; z-index:10; left:350px; top:160px; width:400px;background-color:#dde3eb; border:1px solid #464f5a;”>

<div style=”padding-bottom:8px; width:400px; background-color:#718191; border-bottom:1px solid #464f5a;” onMouseDown=”beginDrag(this.parentNode, event);”>

<div style=”position:absolute; top:2px; left:5px; font-size:16px; font-weight:bold; color:#FFFFFF;”>Drag me!</div>

<div style=”position:absolute; top:3px; left:377px; float:right;” onClick=”this.parentNode.parentNode.style.display = ‘none’;”>

<img src=”How can I create a floating window on my html page.files/close_btn.gif” border=”0″/>

</div>

</div>
<br/>
<div style=”margin-left:20px;”>your content here…</div>

<div style=”margin-left:30px;”>your content here…</div>

<div style=”margin-left:40px;”>your content here…</div>
<br/>

</div>

If you have some skill in CSS styling and JavaScript coding you can add more attractive designs and more functionality to this window.

This entry was posted in Working with HTML and tagged . Bookmark the permalink.
 

  • Submit a ticket

    If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket


Track the comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree