• 0

Can you find out mistakes in these simple codes?


Question

<HTML>

<BODY>

<script language="javascript">

<! - -

document. write("You are using" + navigator. appName + navigator. appVersion)

//- ->

</script>

<script LANGUAGE="JAVASCRIPT">

<! - -

document. write("today" + today.getyear())

// - ->

</SCRIPT>

</BODY>

</HTML>

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

well html is wrong ..

<html>

<head>

<title>blank</title>

</head>

<body bgproperties="fixed" bgcolor="black" text="white">

whatever in here..

that would be more appropriate ..

as for the javascript, looks ok .. i tin .. but not sure on the javascript ..

Link to comment
Share on other sites

  • 0
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;blank&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;
&lt;script type="text/javascript"&gt;
var weekday= new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var today= new Date();
var myyear=today.getFullYear();
var mymonth=today.getMonth();
var mydate=today.getDate();
var myday=today.getDay();
document.write('You are using : ' + navigator.appName + navigator.appVersion);
document.write('&lt;br /&gt;&lt;br /&gt;');
document. write('today is : ' + weekday[myday]+'  '+ mydate +'/'+ mymonth +'/'+ myyear );
document.write('&lt;br /&gt;&lt;br /&gt;');
document. write('today is : ' + today.toGMTString() +' (GMT)' );
&lt;/script&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;

Link to comment
Share on other sites

  • 0

I was bored and hadn't messed with js for a loooong time. :D

So I thought 'why not'? It can possibly be done better but the original poster should be able to follow it and learn how it's done anyways.

Link to comment
Share on other sites

  • 0

ummmm.. try this:

&lt;HTML&gt;
&lt;BODY&gt;
&lt;script language="javascript"&gt;
&lt;!--
today = new Date();
document.write("You are using " + navigator.appName + " " + navigator.appVersion + "&lt;br&gt;");
document.write("today " + today.getFullYear());
//--&gt;
&lt;/SCRIPT&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;

first: u need to declare today as a new Date in order to use today.get.....

2nd: getYear() is not a valid function but getFullYear() is

3rd: you have extra spaces between navigator and appName or appVersion

4th: put a semicolon ( ; ) after a statement

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.