- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming»
- Programming Languages
Javascript: Pop-up window from a HTML link
HTML Javascript Pop-up window
Sometimes you may see the need to have a smaller sized window or browser when a user clicks on a link. This is helpful for Help Topics, Static Information, or just anything that doesn't need the full browser opened. You can also control the scrollbars, toolbar, status bar, location bar, width, height and location on the screen.
Javascript code
Below is the sample javascript code that needs to be placed between the <HEAD></HEAD> tags of your html document. The sample code generates another browser that is 350 pixels wide and 300 pixels heigh. It also allows the scrollbars to show if the content is larger than the window. It is also resizable, but has no Location or status bar.
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!--Hide script from old browsers
function newWindow(newContent)
{
winContent = window.open(newContent, 'nextWin', 'right=10,top=20,width=350,height=300,toolbar=no,scrollbars=yes,resizable=yes,location=no,status=no')
winContent.focus()
}
//Stop hiding script from old browsers -->
</SCRIPT>
HTML Link That Generates The Pop-Up
You will need to create a web page, popup.html, which would have the information that you want to display within the pop-up window.
HTML LINK:
<a href="javascript:newWindow('popup.html')" title="Click for Help">Click For Help</a>
- Javascript: Pop-up window from a HTML link
- Javascript: How to create a simple slide show with clickable links
- Javascript: Pop up Message Box On Submit
- Javascript: How to disable Right Click option
- Javascript: Controlling the number of characters entered into a HTML form field.
- Javascript: How to refresh parent window from a pop-up after closing pop-up
- Javascript: Rotate a different image when the page is reloaded
- Javascript: Drop Down Menu List
- Javascript: A simple calendar with today's date highlighted.
- Javascript: How to hide and show other form fields with a select box with Javascript and HTML