Solved

Window link no scroll, no toolbar

Posted on 2004-09-18
2
827 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Centering Vertically 3 28
Footer at the bottom of the page not centered 5 29
A form to still have contents even if some are wrong 10 47
compact pure CSS Read More Toggle 4 24
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

863 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

27 Experts available now in Live!

Get 1:1 Help Now