locked
Java Script RRS feed

  • Question

  • User1213897375 posted

    can anyone the coding in javascript to open the new pop-up window?

    Friday, November 18, 2011 5:54 AM

Answers

  • User-383679542 posted

    Try window.open method - http://www.w3schools.com/jsref/met_win_open.asp

    window.open("url");
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 5:59 AM
  • User-1360095595 posted
    window.open(): http://www.w3schools.com/jsref/met_win_open.asp
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 6:00 AM
  • User-366017857 posted

    Here is the excellent example

    http://www.textfixer.com/html/javascript-pop-up-window.php

    Creating a popup

    To create a popup you'll need the following script:

    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
    	newwindow=window.open(url,'name','height=200,width=150');
    	if (window.focus) {newwindow.focus()}
    	return false;
    }
    
    // -->
    </script>
    

    Then, you link to it by:

    <a href="popupex.html" onclick="return popitup('popupex.html')"
    	>Link to popup</a>
    

    Open popup.

    OR

    <script>
    function PopupCenter(pageURL, title,w,h) {
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no,

    scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
    }
    </script>

    The link example would be like this:
    <a href="javascript:void(0);" onclick="PopupCenter('http://www.nigraphic.com', 'myPop1',400,400);">CLICK TO OPEN POPUP</a>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 6:03 AM

All replies

  • User-383679542 posted

    Try window.open method - http://www.w3schools.com/jsref/met_win_open.asp

    window.open("url");
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 5:59 AM
  • User-1360095595 posted
    window.open(): http://www.w3schools.com/jsref/met_win_open.asp
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 6:00 AM
  • User-366017857 posted

    Here is the excellent example

    http://www.textfixer.com/html/javascript-pop-up-window.php

    Creating a popup

    To create a popup you'll need the following script:

    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
    	newwindow=window.open(url,'name','height=200,width=150');
    	if (window.focus) {newwindow.focus()}
    	return false;
    }
    
    // -->
    </script>
    

    Then, you link to it by:

    <a href="popupex.html" onclick="return popitup('popupex.html')"
    	>Link to popup</a>
    

    Open popup.

    OR

    <script>
    function PopupCenter(pageURL, title,w,h) {
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2);
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no,

    scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
    }
    </script>

    The link example would be like this:
    <a href="javascript:void(0);" onclick="PopupCenter('http://www.nigraphic.com', 'myPop1',400,400);">CLICK TO OPEN POPUP</a>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 18, 2011 6:03 AM