Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Thanked 0 Times in 0 Posts

    Post file js interaction file .js ?

    help me!

    im have 2 file .js
    file 1.js code:
    document.write("<script src=2.js></script>")

    file 2.js code:
    var f="hello"

    im want run 1.js get variable of file 2.js by 3.html but don't run!

    code 3.html

    <script src=1.js></script>

  • #2
    Regular Coder
    Join Date
    Jun 2011
    Thanked 13 Times in 13 Posts
    firstly I am not sure why you need to use two separates js files to write text to an html document when you can simply place the javascript in your actual html document wrapped in <script> tags...

    As to help with your issue, using document.write() will convert whatever is wrapped in the double quotes ("") into plain html...so using the script tag in the write method will not work.

    To get this to work, do not try to add one js file to another js file...simply add the two separately into your html document in the head section of the page..your declared variables will then be available to both js files and the html document


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts