62 users online (1 members and 61 guests)  


  Results 1 to 6 of 6

Related

  1. Replies: 0
  2. Form Question    Forum: HTML Forum
    Replies: 4
  3. pop up window from form..    Forum: Website Scripts Forum
    Replies: 2
  4. Form Question    Forum: Website Scripts Forum
    Replies: 2
  5. Form Question    Forum: CGI Perl Forum
    Replies: 5
  1. #1
    minds_gifts's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2003
    Posts
    15

    window co-ordinates and form question

    hello,

    2 simple questions:
    1.when you view this http://inkaytown.f2o.org you can observe enter site image appearing somewhere on the top left side of the screen.I would like to position it inside my green background after the text.
    2.when i click on the image, a window is opened.How can i control it in such a way its always positioned in the center of the screen.

    Thanks everybody

    <html>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>|--designed by sarath--|</title>
    <meta name="Microsoft Border" content="none">
    <script type="text/javascript">
    function openwindow()
    {
    window.open("index3.html","my_new_window"," toolbar=no,location=no,directories=no,status=no,me
    nubar=no,scrollbars=no,resizable=no,copyhistory=ye
    s,width=720,height=478,top=5,left=108")
    }
    </script>
    </head>

    <body background="background_copy.gif" bgcolor="#000000" bgproperties="fixed" scroll="no">

    <form>
    <Input type="image" src="main1.jpg"
    value="Open Window"
    onclick="openwindow()">
    </form>

    </body>
    </html>

  2. #2
    sonofmidi's Avatar

    Status
    Offline
    Join Date
    Jan 2001
    Location
    NC, USA
    Posts
    75
    I am assuming that you don't want the background to tile. You should use CSS and not use attributes in the body tag for images, etc. The function uses the url, window name, width and height as arguments so you can reuse this popup w/o embedding the parameters in the function.

    <html>
    <head>
    <title>|--designed by sarath--|</title>
    <script type="text/javascript">
    <!--
    function openWindow(url,winName,width,height)
    {
    var winH = (screen.height / 2) - (height / 2);
    var winW = (screen.width / 2) - (width / 2);

    return window.open(url,winName,'width='+width+',height='+height+',resizable=no,scrollbars=no,resizable=no,copyhistory=yes,top='+winH+',left='+winW+'');
    }
    //-->
    </script>
    <style type="text/css">
    <!--
    body {
    background: #000000 url(background_copy.gif) fixed no-repeat;
    }
    .openWindow {
    position: absolute;
    top: 300px;
    left: 380px;
    cursor: hand;
    }
    -->
    </style>
    </head>
    <body>
    <span class="openWindow" onclick=openWindow('http://google.com','my_new_window',200,200);><img src="main1.jpg" alt="" border="0"></span>
    </body>
    </html>

    BTW, Frontpage will teach you some bad habits.
    Last edited by sonofmidi; 05-04-2003 at 12:01 PM.

  3. #3
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    1: <center></center> or you can view are table tutorials, Dean will probably pop in and give you an even better way with CSS though.

    2: try our pop up tool

    Dave

  4. #4
    sonofmidi's Avatar

    Status
    Offline
    Join Date
    Jan 2001
    Location
    NC, USA
    Posts
    75
    Dave, in order to center a popup, you have to determine the users browser resolution and use the calculation in the above function to set top and left coordinates.

  5. #5
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    I posted at the same time as you but I like your answer much better

    Currently the popup tool uses a default 800x600 for centering purposes, I may have to incorporate your code for other resolutions.

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  6. #6
    minds_gifts's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2003
    Posts
    15
    Thanks dave and sonofmidi!

    I also tried in a different way and it seems to be working fine.
    Code:
    <script type="text/javascript">
    function openWindow(theURL,winName,features, myWidth, myHeight, isCenter) { 
      if(window.screen)if(isCenter)if(isCenter=="true"){ 
        var myLeft = (screen.width-myWidth)/2; 
        var myTop = (screen.height-myHeight)/2; 
        features+=(features!='')?',':''; 
        features+=',left='+myLeft+',top='+myTop; 
      } 
      window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight); 
    } 
    
    </script>
    </head>
    
    <body background="background_copy1.gif" bgcolor="#000000" bgproperties="fixed" scroll="no">
    
    <a href="javascript:;" onClick="openWindow('frameset.html','','toolbar=no,status=no','700','420','true')"> 
    <img src="main1.jpg" border="0" style="position:absolute;left:330;top:280"></a> 
    </body>



Tags for this Thread