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 9108291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:46:28+00:00 2026-06-17T02:46:28+00:00

I am a new programmer and I have a little question. This is a

  • 0

I am a new programmer and I have a little question. This is a part of my code:

<nav>
   <ul>
     <li><input type="button" value="HomePage" id="home1" data-page="home"></li>
     <li><input type="button" value="About" id="about1" data-page="about"></li>
   </ul>
</nav>

    <div id="content">
        <div class="page active">
            <div class=firstLoad>
            (some content...)
            </div>
        </div>
    </div>

<script type="text/template" id="home">
<div id="backImage">
  <div id="spinner">
</div>
<div>
   <input type="button" value="..." id="car" class="button">
</div>
<div>
   <input type="button" value="..." id="Car1" onclick="location.href='#'" class="button">
</div>
<div>
   <input type="button" value="..." id="reset" class="button">
</div>
</div>
<script src="location.js"></script>
</script>

My question is how can I use this “location.js” script tag in the html page (id=”home”) when I call this html page with innerHTML and I change the current appear page?
No matter what I have done this script doesn’t work for me at all in the html page.

Thank you…:)

  • 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-17T02:46:29+00:00Added an answer on June 17, 2026 at 2:46 am

    No, that’s not going to work for you. Not only is it invalid to have a <script></script> inside of another <script>, it wouldn’t work even if the browser could parse it correctly. However, all you need to do is provide the javascript files you want to load in another manner, like in a dataset attribute. Additionally, as Quentin pointed out, text/template isn’t a standard type, so prefix it with x- as standard practice

    <script type="text/x-template" id="home" data-jsassets="location.js,/path/to/some/other.js">
       ...
    </script>
    

    Now, retrieve the comma-delimted list of javascript to load and inject it into the page, which will run the script:

    var tpl, jsassets, tag, i,l;
    tpl = document.getElementById('home');
    // At this point, ensure your template has been rendered and attached to the page
    // by your template processor
    jsassets = (tpl.getAttribute('data-jsassets') || '').split(',');
    for(i = 0, l = jsassets.length; i < l; i++){
      tag = document.createElement('script');
      tag.type = "text/javascript";
      tag.src = jsassets[i];
      document.head.appendChild(tag);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New programmer here, I am trying to understand and break down this code below
This might be a little too much direct question. New to Python I am
I am a new Programmer of Iphone..... i have a little problem in accessing
I am a very new programmer, I have made a couple basic applications, however
I'm a new Python programmer who is having a little trouble using 'self' in
I have a little problem with Java (being a C++ programmer). I have 2
I have a little page I've been working on. It's at: http://nait.jtlnet.com/~fpkj5v0r/programmer.php - and
Sorry about the length of this question. I'm new to Java and I've come
I am new in the ad-sector, I have programmed two little ios games to
hi i am a new programmer i have created an app of my own.

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.