Results 1 to 5 of 5

Thread: How to Open Popup Window in Javascript?

  1. #1
    Join Date
    Aug 2006
    Posts
    181

    How to Open Popup Window in Javascript?

    Hello Friends,
    I have tried to create a popup window in Java and I was successful in doing that. But since I have recently started the Javascript, I don't have much idea of it. Still I have tried to do many R & D but was not successful. So I thought to post to this forum, so that you can help me to solve my problem. Please tell me how to open Popup Window in Javascript.?? The sample of the coding would be greatly appreciable.!!
    QTechnology Ultra-Quiet ATX PSU 460W I MSI K8N Neo4-F I AMD Opteron 144 CABNE0545 2.66Ghz I 2 x 512MB RAM I 380GB Maxtor SATAI Raid0 Hard Drive I 40GB Maxtor IDE Hard Drive I Nvidia GeForce 7900GTX I Win XP Home Service Pack 2 I Soundblaster Xtreme Fidelity Fatal1ty I Mercury Home Theater HT-4500

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: How to Open Popup Window in Javascript?

    Popup Windows are normally used for some important information that needs a quick input from the user. You can also say that the additional browser window opened from a web page are the Popup windows. The popups are opened programmatically using JavaScript. Also for displaying advertisements, the JavaScript Popup windows are used widely. Sometimes it's useful to add a popup to your pages. You have also observed that a new window opens and displays a page, when you click on a link.

  3. #3
    Join Date
    Jul 2006
    Posts
    289

    Re: How to Open Popup Window in Javascript?

    Even I think that popup windows are used for displaying the advertise on your web page. Its totally different from the link of HTML (<a href>). Also you need to understand the event handling, in order to invoke the popup window at certain instances. You will need to handle the onLoad event of the page, if you want to popup a window when the user visits a page. So I thought that giving you an information about the event handling will be useful. If you want to handle the onLoad event and along with that you want to display a message, then you can use the following code :
    Code:
      <BODY onLoad="javascript: alert('On Load event is fired!')">
    Similarly, the following code shows the handler for the unload event :
    Code:
      <BODY onUnload="javascript: alert('Unload event is fired!')">
    Signatures reduce available bandwidth

  4. #4
    Join Date
    Aug 2006
    Posts
    227

    Re: How to Open Popup Window in Javascript?

    I think that looking at the basic script for the popup will help you more to understand. For creating the popup you'll need the following script :
    Code:
    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
    	newwindow=window.open(url,'name','height=250,width=125');
    	if (window.focus) {newwindow.focus()}
    	return false;
    }
    
    // -->
    </script>
    After writing the above script, you will have to link it by following code :
    Code:
    <a href="popwin.html" onclick="return popitup('popwin.html')"
    	>Link to popup</a>
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  5. #5
    Join Date
    Jul 2006
    Posts
    286

    Re: How to Open Popup Window in Javascript?

    According to me using the window.open() function will be more useful for you. Because the window.open() function creates a new browser window, customized to your specifications. This method does that without the use of an HTML anchor tag. You can check the following example which demonstrates the same :
    HTML Code:
    <head>
    <script type="text/javascript">
    <!--
    function myPopup() {
    window.open( "http://www.google.com/" )
    }
    //-->
    </script>
    </head>
    <body>
    <form>
    <input type="button" onClick="myPopup()" value="POP!">
    </form>
    <p onClick="myPopup()">This is PopUp</p>
    </body>
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

Similar Threads

  1. Replies: 4
    Last Post: 24-01-2011, 11:05 AM
  2. JavaScript - open link in same window using location.replace
    By Elizabeth Allen in forum Software Development
    Replies: 7
    Last Post: 13-05-2010, 12:08 PM
  3. How to open Gmail account in a popup Window?
    By roodiii in forum Technology & Internet
    Replies: 5
    Last Post: 01-02-2010, 01:02 PM
  4. Popup Boxes in JavaScript
    By Amaresh in forum Software Development
    Replies: 5
    Last Post: 21-01-2010, 11:51 AM
  5. To open a popup window with no toolbar.
    By Zidaan in forum Software Development
    Replies: 2
    Last Post: 06-07-2009, 10:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,704,267.88933 seconds with 17 queries