Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Want popup to open on top/right instead of top/left

    Hello, I've put three peices of code together, and amazingly, it is working!!! (I'm NOT a techie, and javascript is a new animal for me.) I have a gallery page, with thumbnails on the left, which have mouseovers that show a large picture on the right that changes with the mouseover. Now my client informs me she wants people to be able to click on the thumbnails so a static picture will open that they can rightclick/save. So I have that working, but the window pops up on the top/left side of the screen. Is there any way I can get it to open on the top/right side instead? I've tried changing a few things, but it didn't work so I changed it all back. The page I'm working on is at:

    http://www.sherrypetta.com/theGALLERYtestlinks.html

    Here is the code:
    This is the part of the script in the head that pertains to opening the popup (note that I tried changing the two places it says 'myleft' to 'myright', but it didn't work):

    <!--

    var win=null;
    function NewWindow(mypage,myname,w,h,pos,infocus){
    if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
    settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=windo w.open(mypage,myname,settings);
    win.focus();}
    // -->

    Here is the code in my body - note that I've built this href from several different peices of javascript that I merged together, so there is more script in the head that pertains to parts of it than what I pasted above... I have set the part that pertains to the popup in bold below; and I am just pasting what pertains to one thumbnail/button rather than all thirteen of them:

    <a href=

    "javascript:NewWindow('http://www.sherrypetta.com/images/Flip_1lg.jpg','acepopup','375','400','custom','front');"

    onMouseOver="hiLite('pic','pic2','a','a2'); window.status='Button 1';return true;" onMouseOut="hiLite('pic','pic1','a','a1'); window.status='';return true;" onclick="window.focus()"><img SRC="images/Flip_1.jpg" NAME="a" ALT="Button 1" BORDER=0 height=54 width=54></a>

    OK, hope that makes sense. Hope someone can help!

    kbrimgordon

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Keep it simple. You seem to be overcomplicating it a bit.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <script type="text/javascript">
    <!--
    var win = null;
    function NewWindow(mypage,myname,w,h)
    {
    	sw = screen.availWidth - w;
    	win = window.open(mypage,myname,'width='+w+',height='+h+',top=0,left='+sw+',scrollbars=1,resizable=1');
    	if(win)
    	{
    		win.focus();
    	}
    }
    // -->
    </script>
    </head>
    <body>
    <a href="images/Flip_1lg.jpg" onclick="NewWindow(this.href,'acepopup','375','400');return false" onMouseOver="hiLite('pic','pic2','a','a2'); window.status='Button 1';return true;" onMouseOut="hiLite('pic','pic1','a','a1'); window.status='';return true;"><img SRC="images/Flip_1.jpg" NAME="a" ALT="Button 1" BORDER=0 height=54 width=54></a>
    </body>
    </html>
    Last edited by _Aerospace_Eng_; 06-30-2006 at 06:12 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    I can't help you since I know little about JS. But I use DHTMLMenu to creat this kind of things. Import the image to the parent menu items and adjust the pop-up direction by entering a different value. Then the popup menu will display where you need.


  •  

    Posting Permissions

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