0

I have a thttpd server set-up which has the following html file. When I give address server-address/file-name.html on a standard web browser errors on the script is logged in error console of browser. I am confused about where the script is run actually? Is it on the client side or are the error messages just passed on to browser by server?

My requirement is to run script on a server to generate dynamic web pages upon client interaction.

<html> 
<head> 
<title>Entitled Document</title> 
<script language="JavaScript" > 
Function Java_Scriptfn()
{
    alert('Test'
}
</script> 
</head> 
<body> 
<input type="button" value="Script_Check" onclick="Java_Scriptfn()"> 
</body> 
</html>
ScarCode
  • 3,074
  • 3
  • 19
  • 32

3 Answers3

3

That is purely client side code, so it runs on the client.

As far as I can tell, thttpd only supports server side programming via CGI.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • So please tell me how can I run Script on server side? – ScarCode May 09 '12 at 12:32
  • 1
    @spyke if you really need to run javascript on the server side, you'd have to use a javascript engine for the server. Node.js is becoming quite popular and there's also rhino which runs on the JVM. But as Fabian stated you should probably first get an Overview over the different technologies and then maybe ask a question on how to approach your more general problem. Perhaps you don't even need server side scripts and can use php or Java in a servlet container. – LeoR Jun 15 '12 at 13:37
3

JavaScript that is embedded in a HTML site (either inline or load from another file) is always executed client-side (that means in your browser).

If you want it to be executed, server-side, you need something like node.js.

Polygnome
  • 7,639
  • 2
  • 37
  • 57
2

It's client side code; any Javascript files included in an HTML page will run client-side (although they can talk to a server, that's different).

Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123