SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru tombempty's Avatar
    Join Date
    Oct 2001
    Location
    New York
    Posts
    688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Stupid Question Alert!!!

    Hi all:
    Can someone please tell me what the heck is a <!-- in the begining of a javascript code. I am just learning the language in school and they seemed to skip over this part in the book when I am writing out the code. My DW debugger keeps telling me there's a problem with it but I do not know how to address it.

    The code is
    <!--
    function validate()

    bla bla bla

    help please.

    thanks
    ********
    Regards,

    P

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, here's what it probably looks like

    <script>
    <!--
    code here
    -->
    </script>

    You see, the <!-- and the --> are the opening/closing tags for HTML comments. They can be used inside <script> tags like above to 'hide' the contained javascript from browsers that don't have javascript support. Javascript enabled browsers ignore these comments and read the scripting just fine.

    As far as I'm concerned, this is a pretty outdated application of the syntax. Anyone who surfs the web with a browser that old is by FAR the exception, and not the rule.

    Personally, I never use it.
    Last edited by beetle; Jan 22, 2003 at 15:06.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Guru tombempty's Avatar
    Join Date
    Oct 2001
    Location
    New York
    Posts
    688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    Ok,
    Thanks for clearing this up for me. It was getting on me like.......well, you can fill in your own.
    ********
    Regards,

    P


Bookmarks

Posting Permissions

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