HTM Call JS Code _ Basic Knowledge

Source: Internet
Author: User
1, with JS call htm, the main page how to write?
Write this code in the right place between <body> and </body>:
<script language= "JavaScript" src= "Head.js"
Type= "Text/javascript" ></script>
src= "JS file name and path"
2, JS file How to write?
For example: head.js content so write, the main page of the HTM need to convert to JS code, with the JS statement "document.write" or "Document.writeln" output.
Automatic conversion of software is more convenient, such as: HTML to Anycode, into the corresponding JS file.
Attention:
If you save the document with HTML to Anycode, a "/" symbol will be deleted manually after the end of the file, otherwise the main page will not display the call correctly.
If you copy the code directly, you need to remove the "<script language=" JavaScript >
<!--"and"//--> </script> ", only" Document.writeln "output statements are retained.
PostScript: document.write () and Document.writeln () difference
document.write ()
Writes content to the document, and the current edit position is the last character of the content being written.
Document.writeln ()
Writes the content to the document and adds a newline character, where the current edit position is the starting position of the last line of the written content.
Both document.write () and Document.writeln () are methods that JavaScript writes to the client.
Writeln is output in line, generally the effect of two methods output is no difference on the page, two methods only when viewing the source code to see the difference, unless it is output to the pre or XMP elements.
Copy Code code as follows:

Document.writeln ("Baidu")
Document.writeln ("Baidu")
Document.writeln ("Know")
Document.writeln ("Know")
Document.writeln ("Know")

Copy Code code as follows:

document.write ("<pre> Baidu")
document.write ("Baidu")
document.write ("Know")
document.write ("Know")
document.write ("Know </pre>")

Today tested the classic download Station JS Remote Call, basically achieved the expected effect.
It's the garlic. The label cannot be converted from the system.

The reason consulted, customer service replied: "Can not use JS call, our label is loading the page through a scan, to the label to parse the output, if the call in JS, even if you through the Escape output label will not be resolved." ”

Note that when using JS to convert HTML code, it is best to convert only the contents of the Div placeholder, so that the entire page position is fixed, does not occur dislocation.

In addition, the discovery with JS call JS, "HTML to Anycode" after conversion do not need to make changes, directly available.

Yahoo ads, JS call, do not need special treatment, directly available.
Google, not yet tried, to be resolved later.

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.