PDA

View Full Version : Open in new window behavior


gloomer
01-24-2007, 04:43 AM
It works beautifully, but now I have two questions.

How do I change the background color? It automatically defaults to white. I need to change it to black.

How do I make it so that the popup automatically defaults to the size of image.

<img src="images/eli 12.jpg" width="199" height="174" border="1" onClick="MM_openBrWindow('http://www.elibennett.com/images/eli 12.jpg','','width=720,height=480')"

That's what I have to work with.

Thanks

Stainless69
01-27-2007, 12:19 AM
I'm still learning myself but I'm pretty sure putting the picture in web page and then pointing to the page itself would then allow you to change the background.

domedia
01-27-2007, 03:03 PM
Stainless is right, if you want to control background color you have to put the image in a html document, and popup the html document instead.

For resizing the image, have a look at some of the 3rd party extensions over at the Exchange at Adobe.com

davidj
01-27-2007, 06:57 PM
i like new challenges...

here you go...

main.html
Run this page..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function popup(img, page){
var path = "Images/";
var pageB = eval('"'+page+'"');
image_object=new Image()
image_object.src=path+img;
var h = '"height='+image_object.height;
var w = 'width='+image_object.width+'"';
var winSize = h+','+w;
window.open(pageB, "newwin", eval(winSize));
//window.open("popup.html", "newwin", eval(winSize));
return true;
}
</script>
</head>
<body>
<p><a href="#" onclick="popup('southern.jpg', 'popup.html')">Link1</a></p>
<p><a href="#" onclick="popup('qotsa.jpg', 'popup2.html')">Link2</a></p>
</body>
</html>


in the main page code above look for this ...

<a href="#" onclick="popup('southern.jpg', 'popup.html')">


you need to change the 2 arguments of the popup() function to the image that will appear and the page that will popup

you need 2 html pages called popup.html & popup2.html for this to work. Thes pages contain your images.

also remember to set the page margins to 0 in the popups or you wont return the correct window size as this is being defined by the images.

i have zipped up all the files you need to test this..