Jump to content

about window popup


vivek_damodaran

Recommended Posts

I don't think there's a way to do that otherwise every pop up window would have it so you couldn't close it, and the advertisers are always in your face.

Link to comment
Share on other sites

Set the onUnload event into the body tag to open the page when the event triggers.somepage.htm :

<html><head><title>Blah blah</title></head><body onUnload="if (document.getElementById('someTextarea').value=='')window.open('somepage.htm', '_blank');"><textarea id="someTextarea"></textarea></body></html>

or if you dont like to use inline java script:

<html><head><title>Blah blah</title><script language="JavaScript">function checkIfNothing(){ if (document.getElementById("someTextarea").value == "") {  window.open("somepage.htm", "_blank"); }}</script></head><body onUnload="checkIfNothing();"><textarea id="someTextarea"></textarea></body></html>

Be warned ! the onUnload event also fires when the page is refreshed.

Link to comment
Share on other sites

That is a window.Open() :( Not what vivek_damodaran wants, I think.Use window.createPopup() :) It can have a Close-button, but you should define it entirely, and manual.Like the document having an UL as content, LI being inline (aligned next to eachother). The right LI element would have an X as a character, and the left LI the content of the popup.And this is important: the onclick (at the X) event should activate the showing of the popup. When doing that, just say it has to show it at location (0,0), like it disappears after clicking the X character :)I can give an example of such popup, but it is incredibly complicated. As I defined every style inline for every element, it is not much readable.Try:

function ShowPopup(){var p = window.createPopup()var pbody = p.document.bodypbody.style.verticalAlign="middle"pbody.style.border="4px outset #ffa500"pbody.style.backgroundColor="#eeffaa"pbody.innerHTML = '<ul style="float:left; width:100%; padding:0; margin:0; list-style-type:none">'  + '<li style="display:inline; cursor:default">'  + '<span style="float:left; width:90%; color:black; padding:0.4em 5px">'  + 'Your content</span></li>'  + '<li style="display:inline; cursor:pointer">'  + '<span style="float:right; width:20px; color:navy; padding:0px; border:1px double; border-color:white white black black; '  + 'background-color:#cc6666; font-family:verdana; font-weight:bold; font-size:14px; text-align:center" '  + 'onmouseover="this.style.backgroundColor=\"#ff66cc\";this.style.borderColor=\"black black white white\"" '  + 'onmouseout="this.style.backgroundColor=\"#cc6666\";this.style.borderColor=\"white white black black\"">X</span></li></ul>'pbody.childNodes[0].childNodes[1].onclick = function () { p.show(0,0,0,0,document.body) }p.show(hposition,vposition,width,height,document.body)}
Call this popup inside a javascript section, like this: ShowPopup(); Edited by Dan The Prof
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...