Use the address bar of IE to help debug webpage scripting _ javascript skills

Source: Internet
Author: User
I used the address bar of IE to help debug the web page script. I accidentally used Shift + Left Click to Click a link. the target (href) is a hyperlink of the script, the result shows whether to debug the script dialog box. Click yes to open and debug this script. but where does this script come from?

Look back at the newly opened IE. the result in the address bar is: Javascript: open (url)And. In the original IE address bar, you can use "JavaScript:" To execute the script. you can also try JavaScript: alert ('OK'). it's OK!

For fun, write a complex script: javascript: var s = ''; for (var I = 0; I <10; I ++) s + = I ;. The result is "0123456789", but the execution result is displayed in the main display area of the browser, removing the original content in IE. If it does not affect the original page, wouldn't it be able to read some content in the page and continue submitting after repair? As a matter of fact, you can ensure that the most common sentence of the script is alert (). after the script is executed in the browser, the content on the current page will not be skipped. For example, open the http://www.google.com and enter: javascript: document. getElementsByTagName ('input') [1]. disabled = true; alert (''); in the address bar. what do you see? You cannot enter the query keyword, right?

In fact, the scope of running scripts in the address bar is the script scope of the current page. with this feature, we can execute script statements in a simple way and help us debug scripts, for example, I want to view the values of some variables without entering the complex debugging mode. This is an example when I debug the popup menu. this method can avoid writing status = everywhere during code debugging ....

In addition to JavaScript: In the address bar, you can also write vbscirpt: alert ("OK! "), Ecmascript: and jscirpt. However, ecmascript is automatically converted to javascirpt, and jscript is converted to vbscript.

Although this feature is simple, I hope everyone can come and play with it.

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.