How to use javascript to get UUID and javascript to get UUID

Source: Internet
Author: User

How to use javascript to get UUID and javascript to get UUID

Because javascript is a single-threaded thing, we put an accumulation variable as the id will not be repeated.

But in fact, javascript itself provides something that can get a unique id. Remember that the setTimeout () method returns a unique id to clear the timer, so we can borrow this id.

function getUUID() {        var id = setTimeout('0');        clearTimeout(id);        return id;};



How can I use JavaScript to obtain the URL of the current page?

<Table width = 100% cellpadding = 0 cellspacing = 0 border = 0>
<Script language = "javascript">
ThisURL = document. URL;
ThisHREF = document. location. href;
ThisSLoc = self. location. href;
ThisDLoc = document. location;
Strwrite = "<tr> <td valign = top> thisURL: </td> <td> [" + thisURL + "] </td> </tr>"
Strwrite + = "<tr> <td valign = top> thisHREF: </td> <td> [" + thisHREF + "] </td> </tr>"
Strwrite + = "<tr> <td valign = top> thisSLoc: </td> <td> [" + thisSLoc + "] </td> </tr>"
Strwrite + = "<tr> <td valign = top> thisDLoc: </td> <td> [" + thisDLoc + "] </td> </tr>"
Document. write (strwrite );
</Script>
ThisDLoc = document. location; <BR>
ThisURL = document. URL; <BR>
ThisHREF = document. location. href; <BR>
ThisSLoc = self. location. href; <BR>
<Script language = "javascript">
ThisTLoc = top. location. href;
ThisPLoc = parent.doc ument. location;
ThisTHost = top. location. hostname;
ThisHost = location. hostname;
Strwrite = "<tr> <td valign = top> thisTLoc: </td> <td> [" + thisTLoc + "] </td> </tr>"
Strwrite + = "<tr> <td valign = top> thisPLoc: </td> <td> [" + thisPLoc + "] <& #4 ...... remaining full text>

Everybody, how can I use javascript to retrieve all the content on the current page and save it to the specified directory?

You can use document.doc umentelement. outerhtml to obtain html.
You can use the fso = new actinvexobject ('wscript. filesystemobject ') object to save the file. This is a security issue and it is difficult to set the browser.

The specific requirements depend on the requirements and runtime environment.

In fact, the script has powerful functions, but it also has great limitations. It depends on the situation in which it is used.

I haven't used this for a long time. I can only provide you with one idea. You have to write the code yourself.

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.