Hi everyone, I need help with nesting Javascript code, please! I have two webpages, one is a plain html file (plain.htm) and the other (index.htm) has a DIV that plain.htm loads within when a user clicks a hyperlink. This is done with inline JS, and it works fine. I also want a separate piece of JS from index.htm to be applied to the plain.htm file when it is loaded in the DIV. I'm using an external .js file for this second piece of code, so I need to know where to put the link to it.

Thank you!

I am guessing that you are using frame in this case because you do not provide any code but description which is not totally clear to me. The easiest way is to create another js file with the piece of codes you want from the js file used in index.htm, and then include it in your plain.html (using src).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.