Design a program in js so that it can print its own method to collect Tibetan _ javascript skills

Source: Internet
Author: User
Design a program in js so that it can print its own method to collect and design a program in Javascript so that it can print itself

Script (function () {alert ("script" + arguments. callee + "() <\/script>")}) () script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]



Script function a () {document. write (a, "a ()");} a () script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]



Script (function a () {alert ("script" "+ a +" () <\/script> ")}) () script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]


A nice one

Script function AnyCode () {// Any Code} var anyCode = 0; alert (document. getElementsByTagName ("script") [0]. outerHTML) script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]


I suddenly felt that there was nothing to discuss about this question:

To print all the code, add the following code at the end of the program:
Alert (document. getElementsByTagName ("script") [0]. outerHTML)

If the removed script and script
Alert (document. getElementsByTagName ("script") [0]. innerHTML );

If only the code of a function is printed:
Alert (arguments. callee) // unknown function
Alert (function name) // famous Function

<HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD> <BODY> <script language = "JavaScript"> <! -- Alert(document.doc umentElement. outerHTML); // --> SCRIPT </BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

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.