//first PagevarName=encodeuricomponent ("Parameters");varUrl="test1.html?name="+name;//a second pagevarName=geturlparameters ("name");//Get Parameter MethodName=decodeuricomponent (name);//encodeuricomponent the parameter code. //decodeuricomponent for parameter decoding. My side of the situation is, get URL parameters, on IE display Normal, in Google browser but
In IE without declaring doctype, the browser display window size can only be obtained from the following:Document.body.offsetWidthdocument.body.offsetHeightIn a browser that declares DOCTYPE, you can use the following to get the browser display window size:Document.documentElement.clientWidthdocument.documentElement.cl
corresponding node list. If the Getelementsbyclassname function does not exist, the new function loops through all the tags to find the element with the corresponding class name.
The disadvantage of this approach is that it does not apply to multiple class names.
If you use this function to simulate the previous action to get a shopping list, you can write this:
Copy Code code as follows:
var Shopping=document.getelementbyid ("Purcha
is to prevent browser caching script data, in this case can not be added, but if the script is dynamically generated by the server, it is best to add.Then create two java script scripts for testing.Alert.js:Alert (' You can me! ');Info.js:G (' MyName '). Value= ' spectrum music audio-visual ';G (' MyBlog '). value= ' www.aboutplayer.com ';Well, the music has put them under the aboutplayer.com server so that they and test.html are not in the same doma
Js to get the browser height and width value visible area width of the webpage: document. body. clientWidth: the visible area of the webpage is high: document. body. visible area width of clientHeight webpage: document. body. offsetWidth (including the width of the edge) visible area of the webpage Height: document... js to get the
Program Demonstration:
Obtains the current window size of the browser. When the browser window size changes, the displayed value changes at any time.
The program mainly uses some properties of the Document Object about the window. The main functions and usage of these properties are as follows:
To obtain the Window size, different properties and methods are required for different browsers: to check the
//get the first child element screen browser differences functionGetfirstelementchild (Element) {//ability detection to determine if support Firstelementchild if(element.firstelementchild) {//support for returning elements returnElement.firstelementchild; }Else{ //I do not know the next sibling node varnode =Element.firstchild; while(Node node.nodetype!==1){
Javascript: Get the available width and height of the browser window and screen,
1. Get the valid width and height of the browser window (excluding the toolbar and scroll bar)
NOTE: For the top ten visitors, you can use the specified parameter innerwidthto obtain the width. Use document.doc umentElement. clientWidth |
A class that simulates a browser get and post data that needs to be used frequently,Here are some good ways to collect.Method OneMethod TwoCURL PHP Analog Browser get and post
Background
A colleague raised the question of how to get the current file name in a JavaScript file that was dynamically inserted in the browser.
In addition to the server output a filename, there should be only the following three ways to get it in the script.
Solution A
The universal solution can only be used for page static scripts tag introduction or single
This article mainly introduces JS access screen, browser window size, Web page height width of the implementation code. Need friends can come to the reference, I hope to help you. Web page visible Area wide:document.body.clientwidthnbsp; page visible area high:document.body.clientheightnbsp; Web page Visible area wide: document.body.offsetWidth (including edge width) nbsp; page visible Area High: document.body.offsetHeight (including edge width) nbsp
window in which the HTML document resides.
JS get screen, browser, page height width
Page visible area wide: document.body.clientwidth
Page visible Area High: document.body.clientheight
Web page Visible area wide: document.body.offsetwidth (including edge width)
Page visible Area High: document.body.offsetheight (including edge width)
Page body Full text width: document.body.scrollwidth
The
1, the difference of scrolltop under each browserIE6/7/8:For pages that do not have DOCTYPE declarations, Document.body.scrollTop can be used to obtain scrolltop heights ;For pages that have DOCTYPE declarations, you can use document.documentElement.scrollTop;Safari:Safari is special and has its own function of getting scrolltop: window.pageyoffset;Firefox:Firefox and so on relatively standard browser is more worry, directly with Document.documentElem
When a, input and other elements obtain the focus in the android native browser, an orange highlighted border appears on the peripheral of the element (as shown in the figure below ).To remove it, the common method is: The code is as follows:Copy code A: focus, input: focus {-webkit-tap-highlight-color: rgba (0, 0, 0 );} However, it seems that this solution is invalid in browsers of android 4.0 or later versions. One known method to remove highli
The browser URL parameter value with Chinese characters, in the receipt of direct access will appear garbled, the following is the solution (not required before delivery encodeURI):function Geturlvars () { var vars = [], hash; var hashes = Window.location.href.slice (Window.location.href.indexOf ('? ') + 1). Split (' '); for (var i = 0; i ) { = hashes[i].split (' = '); Vars.push (hash[0]); vars[hash[0]] = has
//get element Next siblingfunctiongetnextelementsibling (Element) {//ability detection to determine if support nextelementsibling if(element.nextelementsibling) {returnelement.nextelementsibling; }Else{ //Get next sibling node varnode =element.nextsibling; //If there is no next node, at this point null while(Node node.nodetype!== 1){ //if the next node of the current nod
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.