• الصفحة الرئيسية
  • إتصل بنا
  • سياسة الخصوصية
Logo
  • الرئيسية
  • أفكار
  • صحة
  • معلومات
  • عجائب وغرائب
  • تكنولوجيا
الصفحة الرئيسية JavaScript Programming Guide How to Show Pop Up Window Using JavaScript

How to Show Pop Up Window Using JavaScript

الكاتب ahmed في 9:15 PM JavaScript Programming Guide
You can show pop up window By using JavaScript window.open() method which loads specified URL into a new or existing window and returns the window object that represents that window.

The window.open() method takes four optional arguments which are URL of the window, Window name, attributes of window, the boolean value to replace or not the current window.

Syntax: window.open("windowname.html", "New Window", "width=width in pixel, height=height in pixel, status=yes or no, resizable=yes or no");

The first argument of window.open() method allows to display given URL in the new window. If the argument is omitted, the special blank-page URL:about:blank is used.

The second argument of window.open() method is a string which specifies a window name. If the argument is omitted, the special name "_blank" is used which opens a new, unnamed window.

The third optional argument of window.open() method is a comma-separated list of size and features attributes for the new window to be opened. If you omit this argument, the new window is given a default size and has a full set of UI components: a menu bar, status bar, toolbar etc.

The fourth optional argument of window.open() is useful only when the second argument names an existing window. It is a boolean value that indicates whether the URL specified as the first argument should replace the current entry in the window's browsing history: written true, or create a new entry in the window's browsing history: written false. And omitting the argument is same as written false.

Here is an example to open a small but resizable browser window with a status bar but no menu bar, tool-bar, or location bar.

window.open("new_window.html", "New Window", "width=400, 
height=350, status=yes, resizable=yes");

Here status bar is showing using status=yes and the window is resizable  using resizable=yes, if you don't want to show status bar, you can use status=no and want the fixed window, can use resizable=no in the argument.

To open a new pop up window on onclick event of button, you can use the following code.

<input type=button name="open" value="Open window"
onclick="window.open('http://www.siteforinfotech.com/p/about-us.html
','new window', 'width=400, height=350, status=yes, resizable=yes');">

Preview:



To open a new pop up window on <a> href link, you can use the following code.

<a href="javascript:void window.open
('http://www.siteforinfotech.com/p/about-us.html', 'new window',
'width=400, height=350, status=yes, resizable=yes');
">Open Pop Up window</a>

Preview:

Open Pop Up window

The return value of the window.open() method is the window object that represents the named or newly created window. You can use this window object in you JavaScript code to refer to the new window and to specify the properties on it as given below.

var w=window.open();
w.alert("You are going to visit:http://www.siteforinfotech.com");
w.location="http://www.siteforinfotech.com";


Here you can specify other properties like width, height, status, resizable given above. And you can assign variable w for any windows event or on any event trigger using JavaScript.

"Pop Up" and "Pop Under" advertisements are made by using this method window.open() while you browse the web. JavaScript codes that tries to open a pop up window when the browser first loads, browsers blocked them. So the advertisements are made to run pop up windows only in response to a user action such as clicking on button and clicking on link. 




Related Search Terms

  • Pop Up Window Using JavaScript

  • Show Pop Up Using JavaScript


Related Posts:

  • How to go Back Browsing History Using JavaScript

  • How to Click Button Using JavaScript?

  • How to Write JavaScript Function as URL in Hyperlink?

  • How to use Round, Random, Min and Max in JavaScript

  • How to Concatenate, Join and Sort Array in JavaScript?

  • How to Loop Through JavaScript Array?

  • How to Loop using JavaScript?

  • How to Show Pop Up Boxes Using JavaScript?

  • How to Write Conditional Statements in JavaScript?

  • How to Write JavaScript With HTML?

  • How to create Changeable Date and Time Using JavaScript?

  • How to Validate a HTML Form Using JavaScript?

  • How to create a simple form using HTML?

  • How to Create JavaScript Image Sideshow with Links

  • How to Display Date Format in JavaScript?

  • How to Validate a HTML Form Using JavaScript?

  • What are the Different Ways to Redirect Page in JavaScript?

  • How to create Timer Using JavaScript?

  • How to make rounded corners border using CSS

  • How to Create Custom CSS Template for Printing

  • How to create a simple form using HTML?

شارك المقال :
Tweet
✚

مقالات ذات صلة

التالي
المشاركةالتالية
السابق
المشاركة السابقة

تحويل كودإخفاء محول الأكواد الإبتساماتإخفاء

شكرا لمشاركتنا رأيك
Subscribe to: Post Comments (Atom)
  • Facebook
  • twitter
  • googleplus
  • youtube
  • linkedin

الأكثر زيارة

  • What is Information ?
    Information  can be defined as data that has been processed into a form that is meaningful to the recipient and is of real or perceived valu...
  • What is Information Technology?
    Definitions of  Information technology  ( IT ) It is a branch of engineering dealing with the use of computers and telecommunications equipm...
  • بالصور الفائزة بمسابقة ملكة جمال مصر 2017
    بالصور الفائزة بمسابقة ملكة جمال مصر 2017
    بالصور الفائزة بمسابقة ملكة جمال مصر 2017 لن تصدق من هي فرح صدقي ↓↓  لمشاهدة الصور والخبر كامل اضغط هنا  ↓↓ رابط المو...
  • Interview Questions on Stack and Queue in Data Structure set-2
    1) The queue in which the insertion takes place in the first position after of last element is a ...... A. priority B. dequeue C. circular D...
  • List of Top 65 Search Engine Submission Add URLs.
    List of Top 65 Search Engine Submission Add URLs.
    To get your site on the top ranking on the search engine results, Your site or URL must be indexed by Search Engines. For that you have to s...
  • List of Best Keyword Research Tools for Better SEO
    List of Best Keyword Research Tools for Better SEO
    Everyone needs to do keyword research work for the site before starting search engine optimization work as the first and most essential tas...
  • What are the different types of scheduling methods?
    Process scheduling is one way for a processor to handle n processes , by scheduling the execution process. Each process is executed one by ...
  • Solved MCQ on Database Backup and Recovery in DBMS set-1
    1) Which of the following is not a recovery technique? A. Deferred update B. Immediate update C. Two-phase commit D. Recovery management 2)C...
  • Solved MCQ on Distributed Database Transaction Management set-4
    1) Commit and rollback are related to .......... A. data integrity B. data consistency C. data sharing D. data security 2) The transaction w...
  • Solved MCQ on Fundamental of DBMS set-10
    1) Which of the following is not a characteristic of a relational database model? A. Table B. Tree like structure C. Complex logical relatio...

الأقسام

  • Artificial Intelligence(AI)
  • Backlinking
  • Basic IT
  • Best List
  • Blogging Tips
  • C
  • C#
  • C++
  • Computer Architecture
  • Computer Fundamental
  • Computer Security
  • Computer/IT Officer Exam
  • CSS
  • Data Mining and Warehousing
  • Data Recovery Tools
  • Data Structure
  • Database Management System
  • E-commerce
  • E-government
  • Internet & Web Designing
  • IT Law
  • IT Tips and Tricks
  • IT Tutorials
  • Java
  • JavaScript
  • Keyword Research Tools
  • MIS
  • Multiple Choice Question (MCQ)
  • Networking
  • Online Earning
  • Online IT Jobs
  • Operating System
  • Oracle Forms and Reports
  • Programming Guide
  • Programming Language
  • SEO
  • Social Networking Sites
  • Software Download
  • Software Engineering
  • System Analysis and Design
  • Top List
  • VB.Net
  • صحة
  • عجائب وغرائب

الأرشيف

  • ►  2017 (4)
    • ►  November (3)
    • ►  October (1)
  • ►  2016 (5)
    • ►  April (5)
  • ▼  2015 (87)
    • ►  August (1)
    • ►  July (8)
    • ►  June (13)
    • ►  May (2)
    • ►  April (2)
    • ►  March (4)
    • ▼  February (20)
      • How to Scroll Top or Bottom of Document Using Java...
      • How to Create Table of Contents Using JavaScript
      • How to Select Document Elements Using JavaScript?
      • How to Show Pop Up Window Using JavaScript
      • How to go Back Browsing History Using JavaScript
      • How to Click Button Using JavaScript?
      • How to Create JavaScript Bookmarklet?
      • How to Write JavaScript Function as URL in Hyperlink?
      • How to create Timer Using JavaScript?
      • How to create a Simple calculator Using HTML and J...
      • How to use Round, Random, Min and Max in JavaSript
      • How to Concatenate, Join and Sort Array in JavaScr...
      • How to Loop Through JavaScript Array?
      • How to Loop using JavaScript?
      • How to Show Pop Up Boxes Using JavaScript?
      • How to Write Conditional Statements in JavaScript?
      • How to Write JavaScript With HTML?
      • How to create Changeable Date and Time Using JavaS...
      • How to Validate a HTML Form Using JavaScript?
      • How to create a simple form using HTML?
    • ►  January (37)
  • ►  2014 (77)
    • ►  December (31)
    • ►  November (4)
    • ►  September (4)
    • ►  August (11)
    • ►  July (8)
    • ►  June (2)
    • ►  May (2)
    • ►  April (2)
    • ►  March (2)
    • ►  February (7)
    • ►  January (4)
  • ►  2013 (132)
    • ►  December (11)
    • ►  November (6)
    • ►  October (4)
    • ►  September (6)
    • ►  August (16)
    • ►  July (9)
    • ►  June (9)
    • ►  May (12)
    • ►  April (13)
    • ►  March (23)
    • ►  February (6)
    • ►  January (17)
  • ►  2012 (59)
    • ►  December (15)
    • ►  November (20)
    • ►  October (21)
    • ►  September (3)

إنضم لنا

© 2017 أفكار جميع الحقوق محفوظة