User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Mar 2005
Posts: 15
Reputation: venetian_jigsaw is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
venetian_jigsaw venetian_jigsaw is offline Offline
Newbie Poster

Help Pop-up attribute question

  #1  
Nov 11th, 2005
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
}
?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Pop-up attribute question

  #2  
Nov 11th, 2005
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:

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

Reply With Quote  
Join Date: Mar 2005
Posts: 15
Reputation: venetian_jigsaw is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
venetian_jigsaw venetian_jigsaw is offline Offline
Newbie Poster

Re: Pop-up attribute question

  #3  
Nov 11th, 2005
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
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Pop-up attribute question

  #4  
Nov 11th, 2005
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:

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.
Reply With Quote  
Join Date: Mar 2005
Posts: 15
Reputation: venetian_jigsaw is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
venetian_jigsaw venetian_jigsaw is offline Offline
Newbie Poster

Re: Pop-up attribute question

  #5  
Nov 11th, 2005
Thanks Thomas...that seems to have doe the trick!
Reply With Quote  
Join Date: Mar 2005
Posts: 15
Reputation: venetian_jigsaw is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
venetian_jigsaw venetian_jigsaw is offline Offline
Newbie Poster

Re: Pop-up attribute question

  #6  
Sep 3rd, 2008
This is a test
Last edited by venetian_jigsaw : Sep 3rd, 2008 at 2:15 pm.
Reply With Quote  
Join Date: Aug 2008
Posts: 375
Reputation: langsor is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 34
langsor langsor is offline Offline
Posting Whiz

Re: Pop-up attribute question

  #7  
Sep 3rd, 2008
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.
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 11:01 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC