How can I get this code to run

Discussion in 'Javascript' started by !!bogus, Dec 16, 2005.

  1. !!bogus

    !!bogus Guest

    The following is the contents of test.htm
    <html>
    <body>
    <script type="text/javascript" src="./test.js"></script>
    </body>
    </html>

    the following is the contents of test.js
    document.open()
    document.write("&lt;html&gt;<BR>")
    document.write("&lt;h1&gt;test&lt;/h1&gt;<BR>")
    document.write("&lt;/html&gt;")

    I would like to have to code in test.js execute instead of being printed.
    How can I do that?

    --
    Thank you
    Please post only
    !!bogus, Dec 16, 2005
    #1
    1. Advertising

  2. !!bogus

    !!bogus Guest

    I would like to be able to pass a parameter from the test.htm to the
    test.js. This is my ultimate goal.

    --
    Thank you
    Please post only
    "!!bogus" <> wrote in message
    news:eek:hsof.3597$...
    > The following is the contents of test.htm
    > <html>
    > <body>
    > <script type="text/javascript" src="./test.js"></script>
    > </body>
    > </html>
    >
    > the following is the contents of test.js
    > document.open()
    > document.write("&lt;html&gt;<BR>")
    > document.write("&lt;h1&gt;test&lt;/h1&gt;<BR>")
    > document.write("&lt;/html&gt;")
    >
    > I would like to have to code in test.js execute instead of being printed.
    > How can I do that?
    >
    > --
    > Thank you
    > Please post only
    >
    !!bogus, Dec 16, 2005
    #2
    1. Advertising

  3. !!bogus

    Michel Guest

    <script>
    var parameter='yeah'
    </script>
    <script type="text/javascript" src="./test.js"></script>

    test.js:

    <script>
    document.write(parameter)
    </script>


    "!!bogus" <> wrote in message
    news:pLsof.4989$...
    > I would like to be able to pass a parameter from the test.htm to the
    > test.js. This is my ultimate goal.
    >
    > --
    > Thank you
    > Please post only
    > "!!bogus" <> wrote in message
    > news:eek:hsof.3597$...
    > > The following is the contents of test.htm
    > > <html>
    > > <body>
    > > <script type="text/javascript" src="./test.js"></script>
    > > </body>
    > > </html>
    > >
    > > the following is the contents of test.js
    > > document.open()
    > > document.write("&lt;html&gt;<BR>")
    > > document.write("&lt;h1&gt;test&lt;/h1&gt;<BR>")
    > > document.write("&lt;/html&gt;")
    > >
    > > I would like to have to code in test.js execute instead of being

    printed.
    > > How can I do that?
    > >
    > > --
    > > Thank you
    > > Please post only
    > >

    >
    >
    Michel, Dec 16, 2005
    #3
  4. Michel wrote:

    > <script>
    > var parameter='yeah'
    > </script>
    > <script type="text/javascript" src="./test.js"></script>
    >
    > test.js:
    >
    > <script>
    > document.write(parameter)
    > </script>


    _All_ `script' elements require the `type' attribute.
    <URL:http://validator.w3.org/>

    `script' element tags do not belong into script files,
    that would _not_ be (X)HTML but a SyntaxError.

    And

    > [top post]


    is unwished here.
    <URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>


    PointedEars
    Thomas 'PointedEars' Lahn, Dec 17, 2005
    #4
  5. !!bogus

    Randy Webb Guest

    Thomas 'PointedEars' Lahn said the following on 12/17/2005 1:28 PM:
    > Michel wrote:
    >
    >
    >><script>
    >> var parameter='yeah'
    >></script>
    >><script type="text/javascript" src="./test.js"></script>
    >>
    >>test.js:
    >>
    >><script>
    >> document.write(parameter)
    >></script>

    >
    >
    > _All_ `script' elements require the `type' attribute.
    > <URL:http://validator.w3.org/>


    Name a browser that handles <script type="text/javascript"> differently
    than it does <script> and that might actually mean something. The only
    time that it even matters is in IE and that is if and only if there is a
    meta element to declare vbscript the scripting language, or, a VBScript
    script element in the page prior.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, Dec 18, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. duncan
    Replies:
    2
    Views:
    6,070
  2. KevinSimonson
    Replies:
    7
    Views:
    341
    Screamin Lord Byron
    Oct 18, 2010
  3. Mike
    Replies:
    1
    Views:
    289
    Alessandro Zifiglio
    Jan 23, 2004
  4. Eugen Ciur

    run code run!

    Eugen Ciur, Sep 9, 2010, in forum: Ruby
    Replies:
    2
    Views:
    103
    Ben Giddings
    Sep 9, 2010
  5. Guy
    Replies:
    2
    Views:
    178
    Dr John Stockton
    Dec 5, 2003
Loading...

Share This Page