1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

External js file help

Discussion in 'HTML & Website Design' started by Jalpari, Mar 20, 2007.

  1. #1
    i want to put my web header by using .js file i know how to put .js external file but don't know how i will get my header code in java script?
     
    Jalpari, Mar 20, 2007 IP
  2. tnd

    tnd Well-Known Member

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #2
    Try this

    <script type="text/javascript" src="path/to/file.js"></script>
    Code (markup):
     
    tnd, Mar 20, 2007 IP
  3. Jalpari

    Jalpari Notable Member

    Messages:
    5,640
    Likes Received:
    137
    Best Answers:
    0
    Trophy Points:
    260
    #3
    should i have to create my header in design view then save it in .js file then i should put .js code into code view where i want tto display header am i right?
     
    Jalpari, Mar 20, 2007 IP
  4. tnd

    tnd Well-Known Member

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #4
    In .js file should has only javascript code or if you want to generate html from javascript you have to make sure there have no error in code.

    Can you give me some example of your javascript code that you want to put in header?
     
    tnd, Mar 21, 2007 IP
  5. Jalpari

    Jalpari Notable Member

    Messages:
    5,640
    Likes Received:
    137
    Best Answers:
    0
    Trophy Points:
    260
    #5
    i know that in .js filw i should have only java code. ya u r right i want to generate html from java script how i can do it?
     
    Jalpari, Mar 22, 2007 IP
  6. Jalpari

    Jalpari Notable Member

    Messages:
    5,640
    Likes Received:
    137
    Best Answers:
    0
    Trophy Points:
    260
    #6
    still no reply .. plz help me how i can save my html code in java script code
     
    Jalpari, Mar 24, 2007 IP
  7. Rasczak

    Rasczak Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    well, just be careful with quotes and {}'s and you should be fine :)

    example:

    var my_html_code_in_js = '<html><head><title>hello world!</title></head><body><h1>Hello World!</h1></body></html>';

    you can use "\n" anywhere inside the code to have lines broken (better debug)
     
    Rasczak, Mar 24, 2007 IP