Get the App
SLTechnology News&Howtos  ›  Development  › 

How to pass parameters by window.open

Shulou Source: shulou.com Published: 2022-06-03 11:02:21 10月11日 Update

This article will explain in detail how to pass parameters to window.open. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The Windowopen () method Window object definition and usage the open () method is used to open a new browser window or to find a named window. Syntax window.open (URL,name,specs,replace) parameter.

Windowopen Settin

1, the most basic pop-up window code

Window.open ('page.html')

2, the pop-up window after setting

Window.open ('page.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') / / the sentence is written in one line of code

Parameter explanation:

Window.open command to pop up a new window

'The file name of the page.html' pop-up window

The name of the newwindow' pop-up window (not the file name). Optional, empty''can be used instead.

Height=100 window height

Width=400 window width

The pixel value of the top=0 window from the top of the screen

The pixel value of the left=0 window from the left side of the screen

Whether the toolbar is displayed by toolbar=no, or not by yes.

Menubar,scrollbars represents the menu bar and scroll bar.

Whether resizable=no is allowed to change the window size, yes is allowed.

Whether location=no displays the address bar. Yes is allowed.

Whether status=no displays the information in the status bar (usually the file is already open). Yes is allowed.

How to pass parameters to windowopen:

1. Open a new window with parameters

$window.open ("/ bdfence/bdfence-division/bdfence.html?vehicleId=" + id)

2. Get the parameters

VarafterUrl= _ window.location.search.substring (1); (string after question mark)

VarafterEqual=afterUrl.substring (afterUrl.indexof ('=') + 1) .toUpperCase (); (the string after the equal sign and the parameters you want)

This is the end of the article on "how to pass parameters in window.open". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Parameters files articles code characters strings screens file names methods more pixels good practical one line information content name command address size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Technology vpn Docker Shulou Information