JS Common code Record

Source: Internet
Author: User

1. Dynamic key gets the corresponding value in an object

JS in a dynamic key to get the corresponding value of an object has two methods:

1 var key = "name1"; var value =2var key = "name1"; var value = eval ("obj." +key);

2, Javascript:history.go () and History.back () the Difference and application

1 <inputtype= ' button 'value= ' Refresh 'onclick= "Window.location.reload ()"> 2 <inputtype= ' button 'value= ' Forward 'onclick= "Window.history.go (1)"> 3 <inputtype= ' button 'value= ' Back 'onclick= "Window.history.go ( -1)"> 4 <inputtype= ' button 'value= ' Forward 'onclick= "Window.history.forward ()"> 5 <inputtype= ' button 'value= ' Back 'onclick= "Window.history.back ()"> 6 <inputtype= ' button 'value= ' back + Refresh 'onclick= "Window.history.go ( -1); Window.location.reload ()"> 

3. How to open a new webpage

window.open ("a.html"); // just indicates the new window opens the page, does not refresh the current page window.location.href= "a.html"; // indicates that a new page is opened and refreshed on the current page

JS Common code Record

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.