Forums | Email a Colleague | FAQ

Dr. Website Archives

Dr. Website® Archives 2002

June 27, 2002
    Question:
    Dear Dr. Website:
    Being new at JavaScript I often find that the html appears on my website. For instance with this script:

    <script language="JavaScript"> function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert("Please don't steal my stuff!!!"); return false; } return true; } document.onmousedown=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; </script>

    I placed it right between the <head> and </head> section on my webpage and it showed up as html for all to see. Could you tell me where I am going wrong? I use Front Page.

    Answer:
    You need to add comment tags so the JavaScript won't show up. You add them directly after the opening JavaScript tag, and right before the closing JavaScript tag:

    <SCRIPT LANGUAGE="JavaScript"> <!-- script goes here --> </script>
    Thanks

    --Dr.Website

    Question:
    Dear Dr. Website:
    I'm looking for a script that does the following:

    - when the user mouseover some hyperlink text, a menu will appear beside the text, and the user can then click on the menu items to invoke some other script functions. - the menu must disappear by itself when the cursor leaves the hyperlink.

    Answer:
    You can do this, but it will only work on MSIE browsers. Microsoft has created a fade tag specifically for this:

    <meta http-equiv="Page-Enter" content="RevealTrans(Duration=1.0)">

    You need to put it within the HEAD tags of your web page. There are many types of transitions available, including:

    Blend in
    Box in
    Box out
    Circle in
    Circle out
    Wipe up
    Wipe down
    Wipe right
    Wipe left
    Vertical blinds
    Horizontal blinds
    Checkerboard across
    Checkerboard down
    Random dissolve
    Split vertical in
    Split vertical out
    Split horizontal in
    Split horizontal out
    Strips left down
    Strips left up
    Strips right down
    Strips right up
    Random bars horizontal
    Random bars vertical
    Random

    You can find more info about how to use these transitions here:

    http://www.webdevelopersjournal.com/wacky/transitions/transitions.html

    --Dr.Website

    Question:
    Dear Dr. Website: How can I improve my site's placement in search engine results?
    Thanks

    Answer:
    The appropriate way to include information about your Web pages for indexing or cataloging programs is to use the <META> tag (for describing "meta information") within the <HEAD> part of your Web documents.

    You would use the NAME attribute to describe the type of information and the CONTENT attribute to list the keywords themselves, as in the following example using HTML code:

    <META NAME="keywords" CONTENT="word1 word2">

    The descriptive terms you use in the CONTENT attribute should add to, not repeat, the terms used in the <TITLE> tag.
    Thanks

    --Dr.Website ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ForumsEmail a Colleague · FAQ