Jump to content

close onblur in popup


cool349

Recommended Posts

hello can someone help me witj this script i want to put a close methed in a popup window i don't know where and how to put ithier is the script<head><script LANGUAGE="JavaScript"><!-- Beginfunction popUp(URL) {day = new Date();id = day.getTime();eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=200,height=200');");}// End --></script></head><body><img src="<%=adoRs("thumb 3")%>" alt="<%=adoRs("plantnaam")%>" width="160" height="160" border="0" onerror=" ImageLoadFailed()"> ps: the adors referse to a source in my database!</body>

Link to comment
Share on other sites

windowname.onUnload = function {	//Action goes here}

Try that (where windowname is the name of your window)

Link to comment
Share on other sites

windowname.onUnload = function {	//Action goes here}

Try that (where windowname is the name of your window)

helloi'm sorry but i can't get it to work<script><!-- Beginfunction popUp(URL) {day = new Date();id = day.getTime();eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=450, left=250,top=100 ,');");}popup.onUnload = function {onblur= self.close}// End --></script>
Link to comment
Share on other sites

The windowname of your function is the actual name of your window (in this case "page" + id), not the function - so try changing "popup" to that.Also, onblur = self.close doesn't make sense. What are you trying to do?

Link to comment
Share on other sites

windowname.onUnload = function {	//Action goes here}

Try that (where windowname is the name of your window)

sorry ik heb al wat gevonden <head><script type="text/javascript">imagename='';function vergroot(beeldnaam){OpenWin = this.open("","GrootVenster","toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no,width=580,height=540,left=241,top=200");imagename = beeldnaam;setTimeout('update()',500)}function update(){doc = OpenWin.document;doc.write('<HTML><HEAD><TITLE>Groot beeld popup<\/TITLE><\/HEAD><BODY bgcolor="#0000CC" onClick="self.close()">');doc.write('<center><IMG SRC="' + imagename + '">');doc.write('<\/BODY><\/HTML>');doc.close();}</script><a onclick="java script:vergroot ('<%=adoRs("image 1")%>');" href="java script:void(0);"><img src="<%=adoRs("thumb")%>" alt="<%=adoRs("plantnaam")%>" width="160" height="160" border="0" onerror=" ImageLoadFailed()"></a>
Link to comment
Share on other sites

Good thing you don't write Javascript in German then.When you create a variable inside of a function, it makes the variable local to that function. For a global variable, you need to declare it outside of any function. Then you can use the same OpenWin variable in both functions. If you use an alert(OpenWin) in the update function you'll see that it is undefined. Also, in vergroot you should use window.open instead of this.open. The this keyword in that context might refer to the link you clicked. And when you use the setTimeout function you don't include the parens.

<head><script type="text/javascript">var OpenWin = null;var imagename='';function vergroot(beeldnaam){  OpenWin = window.open("","GrootVenster","toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, status=no, width=580, height=540, left=241, top=200");  imagename = beeldnaam;  setTimeout('update',500)}function update(){  doc = OpenWin.document;  doc.write('<HTML><HEAD><TITLE>Groot beeld popup<\/TITLE><\/HEAD><BODY bgcolor="#0000CC" onClick="self.close()">');  doc.write('<center><IMG SRC="' + imagename + '">');  doc.write('<\/BODY><\/HTML>');  doc.close();}</script>

Also, the tags like this:<\/TITLE>should be like this:</title>And the onclick should be window.close instead of self.close.Other then that, use a web developer setup for something like Firefox or Opera that will let you view the source code of the page after Javascript modified it, that way you can look at the img link that it's writing out and make sure the image exists if it's not showing up.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...