PDA

View Full Version : Javascript for fixed height + width for window pop up



spancholi
09-21-2007, 03:26 PM
HI,

COULD SOMEONE PLEASE TELL ME HOW TO EDIT THIS CDOE SO THAT WHEN I CLICK ON THE IMG LINK, THE POP UP WINDOW THAT OPENS CAN BE SET AT A FIXED WIDTH & HEIGHT? I AM ALSO INCLUDING THE ORIGINAL DREAMWEAVER FILE IN CASE U WANT TO SEE IT WORKING.

THANKS!:confused:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Global_Medical Information List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><table width="244" border="1">
<tr>
<td><a href="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/treemenu.html" target="_blank"><img src="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/globalmicontact_graphic.jpg" width="244" height="45" border="0"></a></td>
</tr>
</table>

</body>
</html>

boogyman
09-21-2007, 03:33 PM
<a href="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/treemenu.html" target="_blank" ><img src="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/globalmicontact_graphic.jpg" width="244" height="45" border="0"></a></td>
</tr>
</table>

</body>
</html>


<a href="link/path" onclick="window.open(this,newWin,'height=100+width=100')">Img</a>

jscheuer1
09-21-2007, 03:58 PM
<a href="link/path" onclick="window.open(this,newWin,'height=100+width=100')">Img</a>

That won't work unless newWin is defined or quoted. Also, although 'this' should refer to the href, it is best to write it out. And, without a return false, the link will also fire normally. I don't think using the + sign as you have would work either, but haven't tested that.

I would favor something like so:


<a href="some.htm" target="_blank"
onclick="window.open(this.href,this.target,'height=100, width=100');return false;">Img</a>

boogyman
09-21-2007, 05:15 PM
lol thanks john. I knew it didnt look right after I had submitted it. Thanks for correcting my errors

spancholi
09-25-2007, 02:23 PM
Hi Guys,

We're close but still not working. The javascript call is working fine now but my img tag linked with it, isnt working correctly. Can u look at this specific code and fix it with what u have suggested above??

Should work then!

<td><a href="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/treemenu.html" target="_blank"><img src="http://iwha.gsk.com/globalmedicalinformation/globalmedinfo/treemenu/globalmicontact_graphic.jpg" width="244" height="45" border="0"></a></td>

boogyman
09-25-2007, 02:41 PM
what do you mean the image tag linked with it?

spancholi
09-25-2007, 03:57 PM
ok. can u see the attached zip file. it contains the original dreamweaver file in which i need to edit the window code. If u publish it, the pop up window that appears needs to be set at a fixed width & height. u will see what i'm talking about IF U PUBLISH MY DREAMWEAVE FILE.. please let me know if u are able to view it...

THANKS, CANT WAIT!!

boogyman
09-25-2007, 04:01 PM
umm I am asking what about the image link... like what are you trying to accomplish?

whatever you put in the href part of the anchor tag is what would be opened in the new window. if it is the dimensions of the new window you want to edit the script... below in blue are the values that John defaulted it to

<a href="some.htm" target="_blank"
onclick="window.open(this.href,this.target,'height=100, width=100');return false;">Img</a>

spancholi
09-25-2007, 05:41 PM
ok never find, fixed it!! NOW CAN U JUST TELL ME HOW TO ADD RESIZABLE WINDOW OPTION TO YOUR CODE PLZ??

<a href="some.htm" target="_blank"
onclick="window.open(this.href,this.target,'height=100, width=100');return false;">Img</a>

THX!!!

jscheuer1
09-25-2007, 05:56 PM
onclick="window.open(this.href,this.target,'height=100, width=100, resizable');return false;"

boogyman
09-25-2007, 06:31 PM
take a look at http://www.quirksmode.org/js/popup.html for the options available

spancholi
09-25-2007, 07:49 PM
GREAT, THX! You guys are the best :) :) :) :)