Dark Knight Posted August 10, 2006 Share Posted August 10, 2006 Hello, how do I create i popup window? Link to comment Share on other sites More sharing options...
Cronthenoob Posted August 10, 2006 Share Posted August 10, 2006 What sort of pop-up window?One like an add that loads when the page does?A pop-up that shows when a user clicks on a link?An alert box? Link to comment Share on other sites More sharing options...
aspnetguy Posted August 10, 2006 Share Posted August 10, 2006 you are probable looking for window.open('url','windowName','options'); Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 10, 2006 Share Posted August 10, 2006 The popup that isn't actually a window, is created with window.createPopup(), but is Internet Explorer only. The alertbox goes like this: alert() Link to comment Share on other sites More sharing options...
aspnetguy Posted August 10, 2006 Share Posted August 10, 2006 I would recommend avoid using solutions that only work in one browser. You will be alienating alot of your users if you do not make your site as cross-browser friendly as possible. Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 10, 2006 Share Posted August 10, 2006 Correctly! I would say.Look here for a more thouroughly explanation of window.open() :http://www.w3schools.com/htmldom/met_win_open.asp Link to comment Share on other sites More sharing options...
Dark Knight Posted August 30, 2006 Author Share Posted August 30, 2006 A pop-up that shows when a user clicks on a link. that kind of popup window i'd like. Link to comment Share on other sites More sharing options...
Jack McKalling Posted August 31, 2006 Share Posted August 31, 2006 You would use window.open() for that, namely in a script attribute (the onclick) or a function defined in the header section. <a href="blabla" onclick="window.open('mypage.htm','_blank','arguments'); return false">open popup</a>Or<script type="text/javascript"><!--function MyPopup(url) { window.open(url,'_blank','arguments'); return false;}//--></script> <a href="mypage.htm" onclick='return MyPopup(this.href)'>open popup</a> Link to comment Share on other sites More sharing options...
DimNull Posted September 7, 2006 Share Posted September 7, 2006 You would use window.open() for that, namely in a script attribute (the onclick) or a function defined in the header section. :)OrI have a custom popup maker at:http://whytehouse.com/custom-popup-win.aspI am not touting anything here. You may copy the html source code for your own use. I got the script from echoecho.com, and added the top and left variables.Or just copy and paste this into a web page:<script LANGUAGE="JAVASCRIPT"><!-- function MakeNewWindow(){result=new Array(7);for (i=1; i<=7; i++){result[i]="no"};with (document.popup){if (R1[0].checked) {result[1]="yes"};if (R2[0].checked) {result[2]="yes"};if (R3[0].checked) {result[3]="yes"};if (R4[0].checked) {result[4]="yes"};if (R5[0].checked) {result[5]="yes"};if (R6[0].checked) {result[6]="yes"};if (R7[0].checked) {result[7]="yes"};settings="toolbar="+result[1]+",location="+result[2]+",directories="+result[3]+",status="+result[4]+",menubar="+result[5]+",scrollbars="+result[6]+",resizable="+result[7]+",width="+newwidth.value+",height="+newheight.value+",top="+tops.value+",left="+left.value;NewWindow=window.open(url.value, "NewWindow", settings);code.value="\<a href=\"#\" onClick=\"NewWindow=window.open(\'"+url.value+"\',\'NewWindow\',\'"+settings+"\')\;\">,Place Your Linktext Here</a>";}}//--></script><script LANGUAGE="JAVASCRIPT"><!-- function ClearWindow(){with (document.popup)code.value="";}//--></script></head><body><H1><font color="#804000">Online Pop-Up-Coder</font></H1><H4>Enter the url of the page you want to pop-up,<BR>click the desired settings and press the Check Popup-button.</H4><H4>Play with the settings until the<BR>window pops-up exactly as you want it to.</H4><H4>Once you are content with the pop-up-window<BR>you can copy and paste the code to your own page.</H4><form name="popup"><table border="1" BORDERCOLOR=804000 WIDTH=40%><tr><td bgcolor=804000 colspan="2" align=center><font color=FFFFD3><strong>Page To Open In New Window</strong></font></td></tr><tr><td bgcolor=8C7853 colspan="2" align=center><input type="text" name="url" size="30" value="http://www.echoecho.com"></td></tr><tr><td bgcolor=804000 colspan="2" align=center><font color=FFFFD3><strong>New Window Settings</strong></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>toolbar = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes<input type="radio" value="V15" name="R1" checked>| no<input type="radio" name="R1" value="V16"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>location = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V17" name="R2" checked>| no<input type="radio" name="R2" value="V18"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>directories = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V19" name="R3" checked>| no<input type="radio" name="R3" value="V20"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>status = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V21" name="R4" checked>| no<input type="radio" name="R4" value="V22"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>menubar = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V23" name="R5" checked>| no<input type="radio" name="R5" value="V24"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>scrollbars = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V25" name="R6" checked>| no<input type="radio" name="R6" value="V26"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>resizable = </font></td><td bgcolor=8C7853 align=center><font color=000000>yes <input type="radio" value="V27" checked name="R7">| no<input type="radio" name="R7" value="V28"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>width = </font></td><td bgcolor=8C7853 align=center><font color=000000><input type="text" name="newwidth" size="3" value="600"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>height = </font></td><td bgcolor=8C7853 align=center><font color=000000><input type="text" name="newheight" size="3" value="450"></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>top = </font></td><td bgcolor=8C7853 align=center><font color=000000><input type="text" name="tops" size="3" value=""></font></td></tr><tr><td bgcolor=8C7853 align=center><font color=000000>left = </font></td><td bgcolor=8C7853 align=center><font color=000000><input type="text" name="left" size="3" value=""></font></td></tr><tr><td colspan="2" bgcolor=804000 align=center><P><input TYPE="button" value="Check Popup-Button" name="B1" OnClick="MakeNewWindow()"><P><input type="reset" value=" Click here to Reset " name="B2" OnClick="ClearWindow()"></td></tr></table><p align=center><strong>This is the code generated from the above test:</strong></p><P align=center><textarea rows="8" name="code" cols="60" wrap="physical"></textarea></p><H5><font color=804000>Note:</font><br>The code should be pasted into the <a href> tag of the link<BR>you want to trigger the popupwindow. In the example we named<BR>the window "New Window". If you have more than one popup-window<BR>on the same page you need to rename the window names. Use for<BR>example "New Window1", "New Window2" etc.</H5> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now