473,770 Members | 4,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newbie: problem with calling or including .js file

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.getFullYe ar();
}

I have written:

<head>
...
<script src="functions. js" language="javas cript"
type="text/javascript"></script>
</head>

and then I have:

<script language="javas cript"
type="text/javascript">doc ument.write(get CurrentDate()); </script>

There's nothing in oputput.

When I have written simple line:

<script language="javas cript"
type="text/javascript">doc ument.write('AB C');</script>

output is correct (ABC characters).
But when I put document.write( 'ABC'); in Test() function in functions.js and
call it:

<script language="javas cript" type="text/javascript">Tes t();</script>

then there's nothing in output.

The file functions.js has -rw-rw-r-- priviledges.

Please help.
Thanks in advance.
/RAM/
Jun 27 '08 #1
4 2460
On Jun 13, 11:09 am, r_ahims...@pocz ta.onet.pl wrote:
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.getFullYe ar();

}

I have written:

<head>
...
<script src="functions. js" language="javas cript"
type="text/javascript"></script>
</head>

and then I have:

<script language="javas cript"
type="text/javascript">doc ument.write(get CurrentDate()); </script>

There's nothing in oputput.

When I have written simple line:

<script language="javas cript"
type="text/javascript">doc ument.write('AB C');</script>

output is correct (ABC characters).
But when I put document.write( 'ABC'); in Test() function in functions.js and
call it:

<script language="javas cript" type="text/javascript">Tes t();</script>

then there's nothing in output.

The file functions.js has -rw-rw-r-- priviledges.

Please help.
Thanks in advance.
/RAM/
Hi,

I am also a Linux user and have found out that most users of this
newsgroup are not. The people here are usually very helpful but you
need to first identify whether you have a Linux problem, for instance
a permissions problem, or a HTML/Javascript problem.

The easiest way to do this would be to post your index.html and
functions.js files on a server where the newsgroup users can access
them with their own browsers. If the problem is a Javasript (or HTML)
problem they will help you.

Regards,

Steve.
Jun 27 '08 #2
SAM
r_********@pocz ta.onet.pl a écrit :
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.
and calling the file by :
file://localhost/Users/robert/getCurrentYear/index.html
or something like that
(to see if it's really a pb of privileges)
For example in functions.js I have:

function getCurrentYear( )
{
var today = Date();
return today.getFullYe ar();
}

I have written:

<head>
...
<script src="functions. js" language="javas cript"
type="text/javascript"></script>
</head>

and then I have:

<script language="javas cript"
type="text/javascript">doc ument.write(get CurrentDate()); </script>
could be better with : document.write( getCurrentYear( ));
no ?

--
sm
Jun 27 '08 #3
r_********@pocz ta.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="javas cript"
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
--
Jun 27 '08 #4
On Jun 13, 7:15*am, "Álvaro G. Vicario"
<alvaroNOSPAMTH A...@demogracia .comwrote:
r_ahims...@pocz ta.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="javas cript"
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
--
I also notice that your function defined in the .js file is named
getCurrentYear, yet the one you're attempting to call is
getCurrentDate. ..

Do you have Firebug or Venkeman installed on your Firefox
installation? It would show if there were any javascript errors.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
735
by: SamMan | last post by:
I am fairly new to PHP programming, and I'm trying to get my head around this one... I have a form that I am doing validation on via PHP within the same page (form.php), so if there is an error, a message will show to the user above the form. If all goes well, I would like to call a processing script that I have already set up and working to format the users response and send it out to a specified e-mail... I'll call it processing.php ...
1
4668
by: | last post by:
Hey all, Just starting to play with calling DLL's outside the .NET sandbox and I'm hoping for some help with the following: The function prototypes: public static extern long GMW_DS_Query( string szSQL,
2
1759
by: Andre | last post by:
Hi, I have a problem with calling a managed C++ function from C#. The function in C++ looks like Class::Func(char* Text) this function is compiled to an DLL and this DLL is referenced in my C# project and I can see that I could call this function like Func(sbyte* ).
8
3719
by: Henry | last post by:
Hi, in a Windows form VB.Net project I use localization for all texts. In App.Config I added: <appSettings> <add key="locale" value="de"/> </appSettings> In the project I have ressource files strings.resx (English text) and strings.de.resx for the German texts.
12
1918
by: mitek777 | last post by:
Hi, I have a problem with reading from file. I would like to find some string(f e.g. name) in file, and if it exist show it on screen with second and third line under. I have this in file: name surname age
9
4043
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
10
3776
by: Ben Finney | last post by:
Howdy all, Question: I have Python modules named without '.py' as the extension, and I'd like to be able to import them. How can I do that? Background: On Unix, I write programs intended to be run as commands to a file with no extension. This allows other programs to use the command as an interface, and I can re-write the program in some other language
1
3069
by: cainwebdesign | last post by:
php newbie needs help Warning: file(http://shop1.outpost.com/product/5053975) : failed to open stream: HTTP request failed! HTTP/1.1 404 Not Foundin I am just trying to put some code around this to trap it.
0
1520
xarzu
by: xarzu | last post by:
Getting a C# program with a manifest file to run in the debugger ---------------------------------------------------------------- How do I declare a manifest file in the Visual Studio IDE for C# so that I can debug the resulting code? I have been able to add the manifest file, to the exe after I have built the program. But then, when I try to debug my C# code, the program crashes at the point where a function call is made that is used by...
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.