|
-
Dec 15th, 2002, 07:13 AM
#1
Thread Starter
Lively Member
SIMPLE html popups.
Hey.
Whats the SIMPLEST way of making an HTML popup, while still being able to set the height and width of the frame?
Simple question I know, but......
Thanks in advance,
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 15th, 2002, 03:52 PM
#2
Frenzied Member
<A href="java script:window.open(page.html,'popWin','resizable=yes,scrollbars=yes,width=580,height=460,toolbar=yes ,location=yes'); ">open me</a>
-
Dec 15th, 2002, 03:59 PM
#3
Thread Starter
Lively Member
nope, didnt work for me :|
James
Thanks anyways
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 15th, 2002, 10:18 PM
#4
Frenzied Member
"java script" is one word, (this board makes it into a seperate word to help prevent tampering wiv browser operations etc
-
Dec 15th, 2002, 10:38 PM
#5
Junior Member
If you want to create many popup windows and using little code, you should use a function like this
========================================
<html>
<head>
<title>Popup 1</title>
<script language="JavaScript" type="text/javascript">
<!--
var NewWin = null;
function openNewWin(url) {
//========================= SETTABLE VALUES ==========================
var Pwid = 600; //width of popup window - set for best form display
var Phgt = '60%'; //height of popup window as pct of main window
var Pedge = 100; //space on side of popup window
//====================================================================
Pwid = (screen && screen.width>700) ? Pwid : 600;
Phgt = (screen) ? screen.availHeight*(parseInt(Phgt)*.01) : 400;
var Plft = (screen) ? screen.width - Pwid - Pedge : 20;
var Ptop = (screen) ? screen.availHeight/2 - Phgt/2 : 20;
NewWin = open(url,'NewWin','width='+Pwid+',height='+Phgt+',left='+Plft+',top='+Ptop+',scrollbars=yes,resizabl e=yes');
setTimeout('if(NewWin&&!NewWin.closed)NewWin.focus()',100); }
//-->
</script>
</head>
<body>
<p><input TYPE="button" name="Window3" value="DownLoad"
onclick="openNewWin('http://www.download.com')"> <input TYPE="button" name="Window2"
value="MSN" onclick="openNewWin('http://www.msn.com')"> <input TYPE="button"
name="Window1" value="Yahoo!" onclick="openNewWin('http://www.yahoo.com')"></p>
</body>
</html>
========================================
OR, if you want to set each popup window to different settings:
========================================
<html>
<head>
<title>Popup 2</title>
<script LANGUAGE="JavaScript">
<!-- Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End -->
</script>
</head>
<body>
<a href="#"
onclick="NewWindow(http://www.yahoo.com,'yahoo','300','300','yes');return false;">Yahoo.com</a>
</body>
</html>
========================================
-
Dec 16th, 2002, 06:48 AM
#6
Frenzied Member
I would do these kind of pop-ups more like this:
Code:
<a href="http://www.yahoo.com/"
onclick="NewWindow(this.href,'yahoo','300','300','yes');return false;">Yahoo.com</a>
That way people without javascript can view the page too.
-
Dec 16th, 2002, 08:38 AM
#7
Thread Starter
Lively Member
OK, thanks for all yer help 
Thanks to all of ya,
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 16th, 2002, 08:52 AM
#8
Thread Starter
Lively Member
hmm.....
All those bits of code didnt work... lol :|
I would have preferred to use this bit of code: <A href="java script:window.open(page.html,'popWin','resizable=yes,scrollbars=yes,width=580,height=460,toolbar=yes ,location=yes'); ">open me</a>
As it allows to remove the toolbars etc, but I couldnt get it to work.. just got an error (and yes, I did make Javascript one word).
I also found this code:
<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
</script>
<a href="JavaScript:newWindow('comments.htm','popup',202,280,'' )" title="Comments">
Which does work. How would I make this, if the other code doesnt work, to remove the toolbars, and make it non-resizeable. I have tried to do it, but cant :|
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 16th, 2002, 10:51 AM
#9
Frenzied Member
what error did you get on mine?
if all these didn't work then it is something you are doing as they all work.
-
Dec 16th, 2002, 11:16 AM
#10
Thread Starter
Lively Member
I got the error 'comments' is not defined.... :|
And I know its me screwing the code up... it usually is :|:|:|:|:|
lol
Cheers,
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 16th, 2002, 11:49 AM
#11
Frenzied Member
comments?? tha thas nothgin to do with the code I gave you. it must be in the page you are calling or the page that is doing the calling. you have a form field that is called comments?
-
Dec 16th, 2002, 11:56 AM
#12
Thread Starter
Lively Member
Ah. I got the thing to work (it was missing ' ' at either size of the comments.htm.... anyways
Whenever I click the link.. well, see for yourself:
www.darkflight.com/Planned
Click on comments...
The popup appears, but the page messes up too :|
Cheers,
James
Ich widerstehe allem - nur nicht der Versuchung
(I can resist anything but temptation)
-
Dec 16th, 2002, 12:18 PM
#13
Frenzied Member
add this to the end of it.
return false;
so actually it will look like this
<A href="javascript:window.open('comments.htm','popWin','resizable=no,scrollbars=no,width=220,height=28 0,toolbar=no,location=no'); return false;">
then you ned to work on comments.htm file as it is way to big for that small of a window.
-
Dec 16th, 2002, 12:19 PM
#14
Frenzied Member
all seams cool to me?
R U sure its not just your browser?
however, with comments.html Try to use this:
Code:
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<center><iframe src="/Planned/comments1.htm" width="100%" height="100%" frameborder="0" scrolling="auto" style="background-image: url(images/blurrsm.jpg)" title="Comments"></iframe></center>
</body>
But i dont get why u dont just make the popup go to comments1.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|