Click to See Complete Forum and Search --> : Primer for PopUp Window using a Javascript Function


bluknight
04-29-2005, 05:54 PM
First of all, there should really be a "Contact Us" link on the main page so I could have sent this in an e-mail like I intended rather then posting to these forums.

Now remember, this was intended to be an e-mail to the guy who wrote HTML Goodies, so that is why I say "you" and such:

Ok, in this primer here, you have a function to open a window and write to it. I was trying to make a similar thing, but was puzzled as to why it never seemed to finish loading the page, and why the cursor seemed frozen on "busy". It happened in both your example, and my script, so I figured that must just be what happens when you open a window with a function rather than actually opening another url. I was looking around trying to figure out how to do some stuff in Javascript today, and I found this command... "document.close()"... Turns out, in both yours and my scripts, we never closed the document, so it never finished loading.
I have bolded, underlined, and italicized the neccessary line, and here is a link to the primer I am talking about.
It would be very nice if you could fix this, it doesn't look very proffesional, and is bound to confuse other people looking for this same thing.
http://www.htmlgoodies.com/primers/jsp/article.php/3478241

--

<SCRIPT type="text/javascript">

function openindex()
{

var OpenWindow=window.open("", "newwin",
"height=300,width=300");

OpenWindow.document.write("<HTML>")

OpenWindow.document.write("<TITLE>New Window</TITLE>")

OpenWindow.document.write("<BODY BGCOLOR='00ffff'>")

OpenWindow.document.write("<CENTER>")

OpenWindow.document.write("<font size=+1>
New Window</font><P>")

OpenWindow.document.write("<a href=
'http://www.htmlgoodies.com' target='main'>
This will open<BR> in the main window</a><p>")

OpenWindow.document.write("<P><HR WIDTH='60%'><P>")

OpenWindow.document.write("<a href=''
onClick='self.close()'>
This closes the window</a><p>")

OpenWindow.document.write("</CENTER>")

OpenWindow.document.write("</HTML>")

}

OpenWindow.document.close()
</SCRIPT>

...and in the BODY command:

onLoad="openindex()"

---

-Skyler

Fang
05-01-2005, 05:46 AM
The whole script is archaic. This is a common complaint of Jupitermedia sites, i.e. http://javascript.internet.com/
They have said they "regularly" update scripts, but not regularly enough IMHO