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

    Exclamation Help with the <body> and <head> tags

    hello, i am new the whole javascript thing. So my problems are the BODY and HEAD tags. i have been on a few javascript websites to collect scripts for my site. And for almost every script it tells me to put into the head and body tags. but i dont understand what it means. so please if anyone can explain to me. thanks

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by lucio View Post
    hello, i am new the whole javascript thing. So my problems are the BODY and HEAD tags. i have been on a few javascript websites to collect scripts for my site. And for almost every script it tells me to put into the head and body tags. but i dont understand what it means. so please if anyone can explain to me. thanks
    This is rather simple so i'll explain for you.

    When a site says insert it intot he HEAD tag what it means is this

    In your website code you will see something similar to this
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    
    
    </head>
    As you can see there are two header tags <HEAD> and </HEAD> so when a website says insert the javascript into your head tag it means insert it between thes two tags

    e.g
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    
    <script type="Javascript">
       alert("This is osme javascript");
    </script>
    </head>
    And its the same for the body tag you will see an opener <BODY> and a closing tag </BODY> just place the code after the <BODY> tag

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks but i dont get why the site just puts it in themselfves instead of telling us to do it

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,611
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Well how are they supposed to insert the script into your page? They don't even know that you want the script or even that your page exists plus they don't have access to update your site.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    This link may help straighten things out for you:
    http://javascript.about.com/library/blheadbody.htm

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION


  •  

    Posting Permissions

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