![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but there's one strange problem: I have written some JavaScript code in functions.js file which seems to be ignored when called although I have JavaScript enabled in Firefox/Konqueror. For example in functions.js I have: function getCurrentYear() { var today = Date(); return today.getFullYear(); } I have written: head ... script src="functions.js" language="javascript" type="text/javascript"></script /head and then I have: script language="javascript" type="text/javascript">document.write(getCurrentDate());</script There's nothing in oputput. When I have written simple line: script language="javascript" type="text/javascript">document.write('ABC');</script output is correct (ABC characters). But when I put document.write('ABC'); in Test() function in functions.js and call it: script language="javascript" type="text/javascript">Test();</script then there's nothing in output. The file functions.js has -rw-rw-r-- priviledges. Please help. Thanks in advance. /RAM/ |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/getCurrentYear/index.html. The page looks fine but there's one strange problem: I have written some JavaScript code in functions.js file which seems to be ignored when called although I have JavaScript enabled in Firefox/Konqueror. |
|
For example in functions.js I have: function getCurrentYear() { var today = Date(); return today.getFullYear(); } I have written: head ... script src="functions.js" language="javascript" type="text/javascript"></script /head and then I have: script language="javascript" type="text/javascript">document.write(getCurrentDate());</script |
#4
| |||
| |||
|
|
localhost/~robert/rozgloszenia/index.html. The page looks fine but there's one strange problem: I have written some JavaScript code in functions.js file which seems to be ignored when called although I have JavaScript enabled in Firefox/Konqueror. |
|
script src="functions.js" language="javascript" type="text/javascript"></script |
#5
| |||
| |||
|
|
r_ahims... (AT) poczta (DOT) onet.pl escribió: localhost/~robert/rozgloszenia/index.html. The page looks fine but there's one strange problem: I have written some JavaScript code in functions.js file which seems to be ignored when called although I have JavaScript enabled in Firefox/Konqueror. Debugging steps you can take: 1. Check your web server's logs: is the *.js file actually requested? Is it served successfully? 2. Check Firefox's JavaScript console (Tools menu) 3. Get the Firebug extension for Firefox. * * * * <script src="functions.js" language="javascript" type="text/javascript"></script BTW, the language attribute is deprecated. I suppose you don't validate your HTML with W3C validator: you should. Extensions like Web Developer Toolbar for Firefox can help you to validate local HTML or you can just paste or upload the file: http://validator.w3.org/ -- --http://alvaro.es- Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web:http://bits.demogracia.com -- Mi web de humor al baño María:http://www.demogracia.com -- |
![]() |
| Thread Tools | |
| Display Modes | |
| |