JavaScript & HTML - Help!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jamiil

    JavaScript & HTML - Help!!

    This is the first time I am ever using JavaScript, I am not even
    eloquent in HTML, and all I am is someone who has Microsoft/Netscape
    Webpage developers. What I am trying to say is that I am not an expert
    in any of these webpage developing languages. Now, having said that,
    here is my problem.
    I got this program from the book JavaScript "The definitive Guide 3rd
    Edition, by David Flanagan, published by O'Reilly,

    <SCRIPT LANGUAGE="JavaS cript">
    function printDate(){
    var date = new Date();
    document.write( date.toLocaleSt ring());
    }
    </SCRIPT>
    The book shows that this part of the puzzel goes in the <HEAD> and
    </HEAD> tags, the implementation of this function is within the <BODY>
    and </BODY> tags. However, when implementing the function, I get
    nothing, it does not display de date, it does nothing. Here is the
    code:

    <html>
    <head>
    ....
    <title>Jamiil 's Home Page</title>
    <SCRIPT LANGUAGE="JavaS cript">
    function printDate(){
    var date = new Date();
    document.write( date.toLocaleSt ring());
    }
    </SCRIPT>
    </head>


    <body>

    <table border="0" cellpadding="0" cellspacing="0"
    style="border-collapse: collapse" bordercolor="#1 11111" width="103%"
    id="AutoNumber3 " bgcolor="#00000 0">
    ..............
    </table>

    <table border="0" cellpadding="0" cellspacing="0"
    style="border-collapse: collapse" bordercolor="#F FFFFF" width="10%"
    id="AutoNumber1 " height="67" bgcolor="#00000 0">
    <tr>
    <td width="1009%" height="516">
    <table border="0" cellpadding="0" cellspacing="0"
    style="border-collapse: collapse" bordercolor="#F FFFFF" width="100%"
    id="AutoNumber4 " bgcolor="#00000 0" height="523">
    <tr>
    <td width="100%" bgcolor="#00000 0" height="142">
    <img border="0" src="allah.gif" align="left" width="126"
    height="141"></td>
    </tr>
    <tr>
    <td width="100%" height="19"><b> <font color="#FFFFFF" size="1">

    //-----> HERE IS THE CODE IN QUESTION <--------
    <SCRIPT LANGUAGE="JavaS critp">
    printDate();
    </SCRIPT>
    </font></b></td>
    </tr>
    <tr>
    ..........

    Now, can you tell me what am I doing wrong and how to get the current
    date to be displayed in the table cell?

    TIA.

  • Hal Rosser

    #2
    Re: JavaScript &amp; HTML - Help!!


    "Jamiil" <jalqadir@netsc ape.net> wrote in message
    news:1142391934 .313657.85040@i 39g2000cwa.goog legroups.com...[color=blue]
    > This is the first time I am ever using JavaScript, I am not even
    > eloquent in HTML, and all I am is someone who has Microsoft/Netscape
    > Webpage developers. What I am trying to say is that I am not an expert
    > in any of these webpage developing languages. Now, having said that,
    > here is my problem.
    > I got this program from the book JavaScript "The definitive Guide 3rd
    > Edition, by David Flanagan, published by O'Reilly,
    >
    > <SCRIPT LANGUAGE="JavaS cript">
    > function printDate(){
    > var date = new Date();
    > document.write( date.toLocaleSt ring());
    > }
    > </SCRIPT>
    > The book shows that this part of the puzzel goes in the <HEAD> and
    > </HEAD> tags, the implementation of this function is within the <BODY>
    > and </BODY> tags. However, when implementing the function, I get
    > nothing, it does not display de date, it does nothing. Here is the
    > code:
    >
    > <html>
    > <head>
    > ...
    > <title>Jamiil 's Home Page</title>
    > <SCRIPT LANGUAGE="JavaS cript">
    > function printDate(){
    > var date = new Date();
    > document.write( date.toLocaleSt ring());
    > }
    > </SCRIPT>
    > </head>
    >
    >
    > <body>
    >
    > <table border="0" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" bordercolor="#1 11111" width="103%"
    > id="AutoNumber3 " bgcolor="#00000 0">
    > .............
    > </table>
    >
    > <table border="0" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" bordercolor="#F FFFFF" width="10%"
    > id="AutoNumber1 " height="67" bgcolor="#00000 0">
    > <tr>
    > <td width="1009%" height="516">
    > <table border="0" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" bordercolor="#F FFFFF" width="100%"
    > id="AutoNumber4 " bgcolor="#00000 0" height="523">
    > <tr>
    > <td width="100%" bgcolor="#00000 0" height="142">
    > <img border="0" src="allah.gif" align="left" width="126"
    > height="141"></td>
    > </tr>
    > <tr>
    > <td width="100%" height="19"><b> <font color="#FFFFFF" size="1">
    >
    > //-----> HERE IS THE CODE IN QUESTION <--------
    > <SCRIPT LANGUAGE="JavaS critp">
    > printDate();
    > </SCRIPT>
    > </font></b></td>
    > </tr>
    > <tr>
    > .........
    >
    > Now, can you tell me what am I doing wrong and how to get the current
    > date to be displayed in the table cell?
    >
    > TIA.
    >[/color]
    For one thing - you did not spell JavaScript correctly in the Script tag.
    Correct that and it should display the date in white text on black
    background.
    Even though you're using some deprecated tags and other errors, the date
    shows up in a test page I pasted your code into (after closing the missing
    table, body, and html tags


    Comment

    • Jamiil

      #3
      Re: JavaScript &amp; HTML - Help!!

      Oh man! Thanks so very much, it works!

      Comment

      Working...