•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,324 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,297 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1915 | Replies: 6
![]() |
•
•
Join Date: Mar 2005
Posts: 15
Reputation:
Rep Power: 4
Solved Threads: 0
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
}
?>
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
}
?>
The arguments to the window.open() function are: URL, Name, and Features.
URL is self-evident. Name is the name of the opened window, which can be used as an argument for the target attribute of hyperlinks.
Features is an optional list of characteristics of the new window:
For example:
URL is self-evident. Name is the name of the opened window, which can be used as an argument for the target attribute of hyperlinks.
Features is an optional list of characteristics of the new window:
For example:
<a href="myimage.gif"
onClick="window.open('myimage.gif', 'myWin',
'toolbar=no, directories=no, location=no,
status=yes, menubar=no, resizable=no, scrollbars=no,
width=300, height=200');">my image</a>
•
•
Join Date: Mar 2005
Posts: 15
Reputation:
Rep Power: 4
Solved Threads: 0
Thomas,
I am a little confused: this works only if you are calling a single img on a single page and not multiple img's from a single page (e.g. a catalog). Since multiple img's are called from the db, I wrote a function that would grab the img tied to the modelnum, hence my function is executed in the onclick event. So, do I include the attributes in the function or in the event?
Thanks
I am a little confused: this works only if you are calling a single img on a single page and not multiple img's from a single page (e.g. a catalog). Since multiple img's are called from the db, I wrote a function that would grab the img tied to the modelnum, hence my function is executed in the onclick event. So, do I include the attributes in the function or in the event?
Thanks
Your question, as I understood it, was how to remove the toolbar from your opened window. My response was to show you that the window.open() function has an optional "features" parameter to control this.
You need to change this line in your code:
You are passing in "null" as a name, and leaving off the the feature string. Edit it to pass in the features you desire for the pop-up window.
You need to change this line in your code:
prodWindow=window.open("lgImg.php?modelnum="+modelnum+"","null");You are passing in "null" as a name, and leaving off the the feature string. Edit it to pass in the features you desire for the pop-up window.
•
•
Join Date: Aug 2008
Posts: 375
Reputation:
Rep Power: 1
Solved Threads: 34
By the way, many browsers now open pop-up windows as tabbed windows. Which means that you cannot hide the scrollbars of the main window... so if this is important you might try a different approach.
css
window {
overflow: hidden;
}
js
var body = document.getElementsByTagName('body').item(0);
body.style.overflow = 'hidden';
...or...
body.style.overflow = 'auto'; // back to normal
Just a thought
Oops, sorry ... I thought you were trying to hide the scrollbars -- my bad.
css
window {
overflow: hidden;
}
js
var body = document.getElementsByTagName('body').item(0);
body.style.overflow = 'hidden';
...or...
body.style.overflow = 'auto'; // back to normal
Just a thought
Oops, sorry ... I thought you were trying to hide the scrollbars -- my bad.
Last edited by langsor : Sep 3rd, 2008 at 4:05 pm.
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Promotion Techniques (Promotion and Marketing Plans)
- HELP! With Javascripts Pop-Up Window (JavaScript / DHTML / AJAX)
- PHP Pop-up attribute question (PHP)
- My log of annoingness (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: How can i go about this?
- Next Thread: how to load a page in a div tag



Linear Mode