Reputation: 123
I work well with C#. Is it possible for a web page to receive its functionality from a non-JavaScript source? If so, why is it such a common practice to use JavaScript with HTML?
Upvotes: 2
Views: 959
Reputation: 246
JavaScript is an example of a Client-side scripting language where the code is actively interpreted by the browser, which means the browser has to support the scripting language you choose. In HTML, the scripting language is defined by the type
attribute within the <script>
tag.
As of Html5, the default language for all script tags became JavaScript. However, w3.org shows these three examples as client-side scripts in an html page:
I would guess that almost everyone uses JavaScript because it is most widely supported by all the most popular browsers.
If you like C# or some other language, you can do something similar to server-side scripting in ASP.NET.
Upvotes: 0
Reputation: 11384
Yes, of course, you could run just HTML and CSS without a scripting language. But, if you want to use a scripting language, JavaScript is the only one that all major browsers understand.
In the early days of browsers there were some competing scripting languages but they were all dropped for JavaScript.
Upvotes: 0
Reputation: 40673
JavaScript is client-side. If you want some level of interactions in the client then JavaScript is the way to go. (You can also use JS server-side, and there are other client-side options as well, but JS is pretty much the de-facto standard for implementing client side interactions)
It's common because it's a standard. Nearly all (or all?) browsers support JavaScript these days. It was also one of the first browser-supported client-side scripting languages.
Upvotes: 4
Reputation: 1461
They don't have to use Javascript. But if they choose to use a client-side language, it will be Javascript. Because it's the only language browsers can run.
Upvotes: 0
Reputation: 316
I'm pretty sure javascript is the only thing you can use on the front end. I guess you could implement flash or something but flash is dying out and shouldn't be used on the web.
Since you say you're well-versed in C#, you might want to look into ASP.NET. I don't know that much about it, but it's on the same framework as C# (well it should be judging by the name)
Here's a little guide I found on getting started.
Upvotes: 2