How to pop up a new windows from a a link

A

anonieko

<a ><span id="TopMenuBar1_labelHelp"
OnClick="window.open('http://test/admin.htm', 'PSHelp', 'toolbar=no,
directories=no, location=no, status=no, menubar=no, resizable=no,
scrollbars=yes, width=780, height=530')" title="Click here to open the
PS online guide." onMouseOver="this.style.cursor='hand'"
style="font-weight:bold;">Help</span></a>
 
Z

Zif

(e-mail address removed) said on 11/04/2006 1:25 AM AEST:
<a ><span id="TopMenuBar1_labelHelp"

What is the point of the A element here? It performs no useful function
at all.
OnClick="window.open('http://test/admin.htm', 'PSHelp', 'toolbar=no,
directories=no, location=no, status=no, menubar=no, resizable=no,

Allowing code to autowrap frequently introduces errors, as here.

The feature string should not contain any spaces. Typically, just
specify the features you want, the rest will be omitted if the browser
permits:

onclick="window.open('http://test/admin.htm', 'PSHelp',
'scrollbars,width=780,height=530');"


To learn about opening windows, try the following link and the tutorials
listed at the bottom of the page:

scrollbars=yes, width=780, height=530')" title="Click here to open the
PS online guide." onMouseOver="this.style.cursor='hand'"

The cursor property 'hand' is proprietary MS for IE (though some other
browsers may implement it), use 'pointer' (W3C CSS compliant). But if
an A element is used as below, the onmouseover isn't necessary.

style="font-weight:bold;">Help</span></a>

Is there a question here? The normal way to implement pop-ups is to use
an A element with an href attribute of the link that will be opened in
the popup. Use a separate script that can be run from any A element or
onclick.

Return a suitable value from the script, and return the script's exit
value from the onclick so that the link isn't followed if the script
runs successfully (presumably the link will open in a popup if it does).

This also allows the link to be opened in a tab if the user wants
without opening the popup.


<script type="text/javascript">
var popupWindow;
function popWin(url)
{
if (!popupWindow || popupWindow.closed){
popupWindow = window.open('','popupWindow',
'scrollbars,width=780,height=530');
}
popupWindow.location = url;

if (popupWindow && popupWindow.focus) popupWindow.focus();

return !popupWindow;
}
</script>

<a href="http://test/admin.htm"
onclick="return popWin(this.href);"
title="Click here to open the PS online guide"
style="font-weight:bold;">Help</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top