Solved

Window link no scroll, no toolbar

Posted on 2004-09-18
2
825 Views
Last Modified: 2010-05-18
I have an image on my page when I click the image I want it to open new window with no toolbar, not scroll bars, and I want to set the size of the window.

I found this code but I'm not sure how to make it work for an image:

<a href="#" onClick="window.open('your link','link name','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=150,left=150,width=450,height=300')">'link name'</a>
0
Comment
Question by:antonyeo
2 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 12094748
Yes, the code you quoted should work fine.

If you're image is for example images/fullimage1.png with size 400x600 you would then use something like the code below:
I like to have somekind of function in a <script></script> body, because you then would not have to rewrite the whole window.open thing in every hyperlink and your code becomes somewhat cleaner.
<script type="text/javascript">
function showImage(imgUrl, height, width)
{
window.open(imgUrl, 'fullImage', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=' + width + ',height=' + height);
}
</script>

<a href="#" onClick="return showImage('images/fullimage1.png', 400, 600);">See full image</a>
<a href="#" onClick="return showImage('images/fullimage2.png', 430, 600);">See full image</a>

By using the 'fullImage' linkname in your window.open command, you also prevent from opening multiple popups. When one popup is opened, the next image will open in that popup. We could then do something with focus etc, but first check this works like you want it to work.
0
 
LVL 14

Accepted Solution

by:
boonleng earned 500 total points
ID: 12095449
I think this is what you are looking for, just put the image tag inside the anchor tag:

<a href="javascript:void(0)" onClick="window.open('http://www.experts-exchange.com','popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=150,left=150,width=450,height=300')"><img src="http://www.experts-exchange.com/images/certification.gif" border="0"></a>

Use "javascript:void(0)" instead of "#" for the link so that browser wont execute it.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now