Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Pop-up attribute question

Status
Not open for further replies.

venetianjigsaw

Programmer
Mar 25, 2005
29
0
0
US
I am unable to get my pop-up to resize or hide the toolbar when I select a thumbnail. I entered the width & height in my onclick event, bu that did not seem to work. I am guessing that I probably need to enter the attributes in the function and if so, where do they go?

Thanks for any assistance that you can provide!

<script type="text/javascript">
function openWindow(modelnum)
{
prodWindow=window.open("lgImg.php?modelnum="+modelnum+"","null");
prodWindow.focus();
}
</script>

<?php
while ($myrow = mysql_fetch_array($myresult))
{
?>
<tr>
<td><a href='#' onclick='openWindow("<?php echo $myrow['modelnum']; ?>")'><img src='../images/products/<?php echo $myrow ["imgsm"]; ?>' border='0' /></td>
<?php
}
?>
 
See the "null" in the folowing line:
Code:
prodWindow=window.open("lgImg.php?modelnum="+modelnum+"","null");
If you change that to something like the following, then you will get what you expect:
Code:
prodWindow=window.open("lgImg.php?modelnum="+modelnum+"","[b]width=300,height=400,status=0[/b]");
If you need more help with this, probably best to move it to the Javascript forum.
Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Jeff,

Thanks for your help, but IE gives me an error message when I use the attributes.

Again, thanks for looking into! =)
 
IE error msg says it's an invalid argument and will not display my pop-up until I change the js back to what it was originally. However, when I run in NS7, I am able to launch a pop-up, but when I change my w & h settings, the pop-up doesn't change. I ran the js tool in NS7 and it does not find any problems with my code.

 
Ahhh. I think I see what we're missing...

Code:
prodWindow=window.open("lgImg.php?modelnum="+modelnum+"",[b]"nameofwindow",[/b]"width=300,height=400,status=0");

It's important to have no spaces in the second parameter to that popup (which is the name of the window). I have populated it with "nameofwindow" but you could just as easily revert to the original "null".

See... instead of replacing the "null" I should have encouraged you to extend the parameters. Anyway, the above fix should see you right. Apologies for the oversight [smile]

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
if you ask this in the javascript forum, you'll possibly find answers about toolbar=no, menubar=no etc etc .. how to pop up an image with not much of anything else.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Jeff,

You are the man!!! Thanks a million. That did the trick. Now, I have this 1969 GTO convertible that is.... =)

Take care.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top