Is This JavaScript?

Giarc86

Expert Member
Joined
May 28, 2008
Messages
1,243
Reaction score
4
<html>
<body>


<center>
<form name="Tel">

<table border=4>
<tr>
<td>
<input type="text" name="Input" size="16"><br>
</td></tr>
<tr><td>


<input type="button" name="1" value="1" OnClick="Tel.Input.value += '1'">
<input type="button" name="2" value="2" OnClick="Tel.Input.value += '2'">
<input type="button" name="3" value="3" OnClick="Tel.Input.value += '3'">

</body>
</html>
 
Isn't ~~OnClick="Tel.Input.value += '1'~~ javascripting code in some way though?
 
No, that is not necessarily Javascript. That is purely HTML, telling the browser that if that input object experiences a OnClick event, it should run that piece of code. It could be JavaScript. What that is doing is telling the browser to update a value of a item in the form Tel, with the name Input. It is really up to the browser to decide which scripting language to run, as it is not defined. Nowadays, it will most likely be interpreted as Javascript, as that is the default scripting language in most browsers.
 
Onclick is purely an event linked to radiobuttons etc. It's not Javascript per se.

You can however call scripts like javascript from the event
 
I have to disagree here - the script called for the OnClick event-handler is actually javascript being executed. A browser will default to JavaScript in instances where a scripting language wasn't explicitly declared in a <script> tag.
 
<input type="button" name="1" value="1" OnClick="Tel.Input.value += '1'">
<input type="button" name="2" value="2" OnClick="Tel.Input.value += '2'">
<input type="button" name="3" value="3" OnClick="Tel.Input.value += '3'">

Highlighted for clarity - bold is javascript
 
Top
Sign up to the MyBroadband newsletter
X