Using JavaScript Pop Up windows in a Publisher web

 Sometimes it can be useful to display information in a small pre-configured pop-up window. For example if you had a hyperlink that said “more details” and that link opened a small pop-up with details related to the primary windows content.

This should not be confused with the intrusive advertising technique of “pop-up’s”, that pop-over or pop-under without the visitor’s consent or prior knowledge.

To launch our window we need to use a small snippet of JavaScript. Publisher has no built-in support for scripting so you use the HTML Code Fragment dialog to insert the script.

The HTML Code Fragment dialog is located in the Insert menu, and the dialog is drawn on the page where it is needed like you do with a text box or picture frame.

Our snippet of code contains the hyperlink so you will insert the code fragment on your page where you are wanting the hyperlink to be located. Simply copy and paste the following code:

<a href=”’pagename.htm’,’windowname_window’,’toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=400, height=400′);windowname_window.focus()”>Link Text Display</a>

Obviously you need a web page that this link is opening, that web page is what is specified in place of “pagename.htm”. Replace the link text display string with your desired hyperlink text.

You will set the width and height numbers to the pixel sizes you want the web page to be sized to in the pop-up. If you want the visitor to be able to resize the window change the resizable variable to 1. If you want scroll bars to not display set the variable for that to 0. Other common settings you may want to set are – display toolbar, status bar, menubar – yes is 1, no is 0.

If you use this snippet more than once on a page you will need to change the “windowname” in each snippet to enable them to differentiate themselves on the page.

You can see an example of this pop-up technique by visiting and clicking the Contact Us link at the bottom of the page.

Leave a Reply

Your email address will not be published. Required fields are marked *