Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:48:24+00:00 2026-06-14T11:48:24+00:00

I want to dynamically add a javascript tag, whose src points to an external

  • 0

I want to dynamically add a javascript tag, whose src points to an external source, whose
result will generate some other javascript. That javascript will draw external data, a table for football teams.

If I include it with document.write it works fine.

<script type="text/javascript">
var everysport_u="http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html";
document.write("<scr"+"ipt type='text/javascript' charset='ISO-8859-1' src='"+everysport_u);
var everysport_r=Math.floor(Math.random()*99999999999);
document.write("?_r="+everysport_r);
document.write("'><\/scr"+"ipt>");
</script>

Howevery using DOM manipulation it does not.

var script = document.createElement('script');
var everysport_r=Math.floor(Math.random()*99999999999);
var everysport_u = "http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html";
script.src = everysport_u;
script.type = 'text/javascript';
document.getElementById('everysport-accordion').appendChild(script);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:48:25+00:00Added an answer on June 14, 2026 at 11:48 am

    The script at http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html is using document.write. A script which uses document.write can only be included during the loading of the page. After the page loads, document.write no longer functions as expected.

    It’s fine to include a script which itself does DOM manipulation with DOM manipulation. But the fact of the matter is document.write expects to be able to write immediately to the document wherever it is located. Trying to document.write after the page has loaded will clear the current page and override it.

    Check out this simple example: http://jsbin.com/azumus/1/ (and click refresh a few times).

    If you do add a script which uses document.write to an element higher up in the page during page load, the document.write will write to the page, but not where you intend it to. document.write will only write where the page is currently loading; it can’t be used to write into any element you want it to.

    See this page for an example: http://jsbin.com/ayomoz/1/ (and view source).

    In summary

    Put your <script> tag wherever you intend to write to the document. If you want to write to the element with id everysport-accordion, you need to do something like this:

    ...
    
    <div id="everysport-accordion">
        <script type="text/javascript">
            var everysport_u="http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html";
            document.write("<scr"+"ipt type='text/javascript' charset='ISO-8859-1' src='"+everysport_u);
            var everysport_r=Math.floor(Math.random()*99999999999);
            document.write("?_r="+everysport_r)
            document.write("'><\/scr"+"ipt>");
        </script>
    </div>
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add an external JavaScript or CSS file in my test.html dynamically.
I want to dynamically add .Select statements, but the compiler will only allow me
I want to append a div tag generated by jQuery dynamically with a javascript
I want to add text dynamically on an image. I tried to use javascript
I want to add javascript to asp.net page dynamically. can anybody point me towards
After ul tag i want to call function in javascript to add list item
I am using JavaScript to dynamically add an element to the DOM. I want
I'm developing a web page using django and I want to add some javascript
I want to dynamically add some columns (and remove others) from an html table.
I want to add/remove rows in a table dynamically. I have javascript function to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.