Open window

javascript United Kingdom
  • 18 years ago

    Hi


    How do i open a IE window, which has no toolbar, menubar etc, and is 100*100 pixels, with my image, image1 loaded into it.


    I think this is done using Javascript.


    Thanks

  • 18 years ago

    okay so I am guesing you dont want to load an existing page but make one up in real-time when hte user requests etc.


    So heres my way of doing it:

    Code:

    <script language="JavaScript">
    //<!-- Hide this code from non-Javascript browsers
     browserVer = parseInt(navigator.appVersion);


     // Disables Please Wait for AOL browsers - they suck anyway!
     if (navigator.appVersion.indexOf("AOL") == -1) {
       if ((navigator.appName == "Netscape") || (browserVer >= 4 && navigator.appName.indexOf("Microsoft") != -1)) {
         var w = window.open("","WindowName","resizable=no,width=100,height=100,status=no,top=200,screenY=200,left=300,screenX=300,alwaysRaised=yes");
         w.document.write('<html><head><title>My Image1</title>');
         w.document.write('');
         w.document.write('</head>');
         w.document.write('<body BGCOLOR="#FFFFFF">');
         w.document.write('');
         w.document.write('<table>');
         w.document.write('<tr>');
         w.document.write('<td>');
         w.document.write('<p>');
         w.document.write('Insert any text here! <br>');
         w.document.write(' ');
         w.document.write('<img name="image1" src="http://www.wsoftware.net/images/websoftware.gif"><br>');
         w.document.write('<br>And any any other crap here onwards! </p>');
         w.document.write('</td></tr></table><p>  </p>');
         w.document.write('</body></html>');
         w.document.close();
       }
     } // end AOL check


    function popClose() {
    // Close the popup window
     if (navigator.appVersion.indexOf("AOL") == -1) {
       if ((navigator.appName == "Netscape") || (browserVer >= 4 && navigator.appName.indexOf("Microsoft") != -1)) {
         if (w.closed) {
           return;
         }
         else {
           w.close();
         }
       }
     }
    }


    // End hide from old browsers -->
    </script>



    Hope that helps!


  • 18 years ago

    heres a simpler way that i use, its


    Code:

    <script LANGUAGE="JavaScript">
    <!--//hide script from old browsers
    function launch() {
    open('me.htm', 'tipofday', 'resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, width=300, height=300') }
    document.write('<p align="center"><A HREF="javascript:launch()">Click here now!</A>')
    //end hiding contents -->
    </script>




    you will have to make another page with the picture in it, and just call it me.htm
    or change the me.htm ( in the code) to thepicturename.jpg so it just loads a picture

  • 18 years ago

    yup its simple! I just like to make things too complicated... which is why i cant understand what i do sometimes... lol!


    The code above means you can create dynamic popup pages in real-time... say ASP/PHP etc driven page which shows the user's name? well this can be achieved by using hte code above because there is no static file your linking to. Bur if you after just to show the same message for anyone then go with rollershades idea... its smaller!


    Hope that helps!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens