PDA

View Full Version : Problem using javascript src=file


wgw
March 16th, 2008, 07:18 PM
I have just set up a dapper server. I have a helloworld.js and helloworld.htm files in public_html . Permissions are set on both as: 755. The onclick function in the .htm file does not work (error message: helloworld not defined); I assume the .js is not getting read into the html page. This is weird. It should work; any ideas? (I'm imagining that the server is configured to block reading .js files...)

Thanks!


helloworld.htm:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
<script type="javascript/text" src="helloworld.js">
</head>
<body>
<button onclick="helloworld();"> Click </button>
</body> </html>

helloworld.js:

function helloworld(){

alert("hello world");
}