English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm self-taught Javascript, HTML, and XHTML. HTML and XHTML work very well. But, when I write Javascript, it doesn't work though my IE tell me there is Active Control X in my site. I copied a Javascript from a site and put it in Notepad and it worked, so the problem is not in the browser, I think it's in my Javascipt. This is a sample, check it for me pls.:
var time=get hours()

if(time>5)
{
document.write:("Not Twilight yet, sir!!!")
}

2007-01-23 18:35:26 · 6 answers · asked by Palestini Detective 4 in Computers & Internet Programming & Design

Pls. read the details carefully. The 1st, 2nd, 3rd, and 5th answers tell me that there is a problem that would stop all my Javascipt, nevertheless only Javascript written by me don't work.!!!

2007-01-24 01:50:31 · update #1

6 answers

There's shouldn't be a colon there.

2007-01-23 20:41:28 · answer #1 · answered by Anonymous · 0 1

first of all, you need to remember that javaScript is case sensitive, that means that get hours() is not the same with getHours() (which, by the way, is the correct function name). If you really want to learn javascript, I recommend you the w3schools site, which, in my opinion is the most compete javaScript reference. However, I recommend that you use javascript only when necessary, because not all of its functions are cross-browser compatible. For more details, see the w3schools site.

2007-01-24 02:56:42 · answer #2 · answered by adi r 2 · 0 1

Download and install Netscape Browser. The javascript console is an excellent debbuging tool for javascript.

2007-01-24 04:53:18 · answer #3 · answered by Norman Bates 2 · 0 1

JavaScript can be used to deliver viruses via web sites, so newer browsers are now blocking certain parts of their code in order to keep people safe.

With CSS, PHP and other languages JavaScript will soon become obsolete.

2007-01-24 02:44:15 · answer #4 · answered by Kleineganz 5 · 0 2

i think with the newer browsers you have to enable the browser to run the script on each and every site load.

Unfortunately this make Javascipt a dying breed.....

2007-01-24 02:39:05 · answer #5 · answered by Anonymous · 0 1

var time=get hours()

is invalid syntax and just wrong for so many reasons!!!

try
var curdate = new Date()
var time = curdate.getHours()

It's amazing how many 'experts' blew this completely!!!

2007-01-24 13:55:41 · answer #6 · answered by jake cigar™ is retired 7 · 1 0

fedest.com, questions and answers