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]