JS control span content

Source: Internet
Author: User
Building owner exceyond (Nanke) 18:05:43 question in Web development/JavaScript

Example:

<Script language = JavaScript>
VaR pakstring = "lalalala"
Document. All. Pak. innerhtml = pakstring;
</SCRIPT>
<HR> call <HR> fail <HR> <SpanId = Pak> </Span>


The error message is "document. All. Pak is empty or not an object"

Please correct me. Remember to write this before. In addition, the newly installed IE6 issue points: 30. Reply times: 5top

  Kisslan on the first floor)Back to 18:28:26 score 10

SetJSPut inSpanLater, you put it in front, it has not been resolvedSpanSo the top

Exceyond (Nanke) on the second floor)Back to 18:38:20 score 0

My intention is to write a piece of HTML inJSAs an independent file.
<SCRIPT src = mycode.JS> </SCRIPT> in <SpanId = Pak> </Span> Is there a way to implement the preceding situation?

In the impression, HTML is a tough fight,JSMost

Thank you for your advice. Top

Afoskoo on the third floor (print suspended)Back to 18:41:05 score 10

Write as a function, and then call. top at the end

4 floor lidelu (animator)Back to 18:43:54 score 10

JSIf it is called as a function, it can be placed in a location on any page
However, if you want to directly load the page, you have special requirements.

When you execute document. All. Pak. innerhtml = pakstring; on your page,
<SpanId = Pak> </Span> The object cannot be found because it has not been loaded.

If you wantJSAs an independent file,
<SpanId = Pak> </Span> Later, such as the end of HTML. Top

Exceyond (Nanke), 5th Floor)Back to 18:53:25 score 0

Either adding the code in HTML or modifying the Code Location in HTML, I don't have that big permission to require the customer to change so much

The possible method is,
1. Determine that other HTML files have been downloaded and then execute the externalJS;
Second, the time delay is simply used when it cannot be accurately determined, and will be executed in a few seconds.

Check whether the HTML page has been downloaded (excluding externalJS?

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.