Results 1 to 3 of 3
  1. #1
    lilith2014 is offline Member
    Join Date
    Apr 2008
    Posts
    1
    Rep Power
    0

    Default nebie popup script, need to add code.

    Hello all, simple question for you. This is my code:

    Java Code:
     <SCRIPT TYPE="text/javascript">
    <!--
    function popup(mylink, windowname)
    {
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window.open(href, windowname, 'width=400,height=323,scrollbars=no');
    return false;
    }
    //-->
    </SCRIPT>
    I need to add on it a function that put the popup in the middle of the screen.
    Also if I can change the backgrond color to black how can I do it?

    Thank you for you help.

  2. #2
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Default

    Hello Lilith2014.

    These forums are for Java questions. JavaScript is actually a completely different language.

    I suggest you search google for a dedicated JavaScript forum. You will find a lot more help there than here!

    Another google search revealed this:

    Java Code:
    <SCRIPT LANGUAGE="JavaScript">
    function MyPopUpWin() {
    var iMyWidth;
    var iMyHeight;
    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (window.screen.width/2) - (75 + 10);
    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (window.screen.height/2) - (100 + 50);
    //Open the window.
    var win2 = window.open("filename.htm","Window2","status=no,height=200,width=150,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    win2.focus();
    }
    </SCRIPT>
    To call this function in HTML use this:

    Java Code:
    <A HREF="javascript:MyPopUpWin()">This is the link</a>
    Last edited by DonCash; 04-30-2008 at 10:48 AM.
    Did this post help you? Please me! :cool:

  3. #3
    praveeprenha is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Default

    I didn't catch your java code....... pls write new codings.... thank you

Similar Threads

  1. Java Popup Window & Url Query String Value
    By Rivelyn in forum New To Java
    Replies: 4
    Last Post: 01-20-2011, 05:03 AM
  2. how we get popup window in java
    By baserohit in forum Advanced Java
    Replies: 1
    Last Post: 03-22-2008, 04:39 AM
  3. Communicating with JSP and popup
    By nilz in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-20-2007, 04:29 PM
  4. Popup in Java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:55 AM

Posting Permissions

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