...

View Full Version : Want popup to open on top/right instead of top/left



kbrimgordon
06-30-2006, 05:58 AM
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=window.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

_Aerospace_Eng_
06-30-2006, 06:07 AM
Keep it simple. You seem to be overcomplicating it a bit.

<!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>

xixi
06-30-2006, 07:32 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum