Jump to content

Using InnerHTML to include External Text


Jon JC
 Share

Recommended Posts

Hi,I want to include an external text (or .js/.html) file into a specific section of an HTML page. This is what I have right now:<script type="text/javascript">function changeText(){var cell=document.getElementById('textLocation').rows[0].cellscell[0].innerHTML="<script src=\"ExternalText.js\"></script>"}</script>This obviously does not work. I think it is because the <srcipt> tag does not support nested <script> tags. Any ideas?JC

Link to comment
Share on other sites

You can't do this with just plain javascript. You would need AJAX or server side scripting code (SSI, or server side includes) Check out the AJAX section of the W3Schools page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...