Results 1 to 14 of 14

Thread: SIMPLE html popups.

  1. #1

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116

    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)

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    <A href="java script:window.open(page.html,'popWin','resizable=yes,scrollbars=yes,width=580,height=460,toolbar=yes ,location=yes'); ">open me</a>

  3. #3

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    nope, didnt work for me :|

    James

    Thanks anyways
    Ich widerstehe allem - nur nicht der Versuchung

    (I can resist anything but temptation)

  4. #4
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    "java script" is one word, (this board makes it into a seperate word to help prevent tampering wiv browser operations etc
    Wayne

  5. #5
    Junior Member Mark3's Avatar
    Join Date
    Aug 2002
    Posts
    26
    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>

    ========================================

  6. #6
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    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.

  7. #7

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    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)

  8. #8

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    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)

  9. #9
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    what error did you get on mine?

    if all these didn't work then it is something you are doing as they all work.

  10. #10

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    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)

  11. #11
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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?

  12. #12

    Thread Starter
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    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)

  13. #13
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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.

  14. #14
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    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
    Wayne

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width