Results 1 to 2 of 2

Thread: javascript general questions

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default javascript general questions

    js q
    The
    Code:
    <script type="text/javascript">
    //<![CDATA[
    .... javascript code
    //]]>
    </script>
    or //<!--, and //-->
    are equivalent ?

    When I use fieldset in an html form may
    1) may include image as title ?
    2) may choose color and size of border of fieldset enclosed ?
    3) may choose a background for the fieldset content area ?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    They're similar, but each is designed to 'hide' the javascript from different processes. The CDATA comment (if properly formed, I'd have to Google that to be sure) is to hide it from xml processing (which if your page isn't doing, and can't do via its DTD and opening tags, you don't need to worry about), and the HTML style comment (which is actually <!--, and // -->) is to hide it from older browsers (very old browsers, at this point) that don't know enough to ignore what's inside a script tag, even though they don't support javascript. The two may be combined somehow, but again I'd have to Google that for the exact syntax.

    The rest of your questions I'm not 100% sure on, but I'm 100% sure that some of these vary by browser, degrading reasonably well where not supported. My best advice to you on them is to try them. But you should also consult the w3c standard to see if they are technically allowed. If they are not, they will probably cause problems in some cases, in some browsers. The easiest way to test conformance of your HTML markup is with the validator:

    http://validator.w3.org/
    Last edited by jscheuer1; 05-17-2008 at 05:31 PM. Reason: add detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •