HTML Old School

Button

For submitting HTML forms it is bette to use <button></button> then <input type="submit">.

This is because button tag is container and we can put text, other html tags, even image between button tags.

<form action="19script.php" method="POST" enctype="application/x-www-form-urlencoded">
      
      name: <input type="text" name="var" value="">

    <br><br>
      <button type="submit">Send</button>
      <button type="reset">Reset</button>
      <button type="button" onclick="alert('This is warning')">Alert</button>

</form>

 

Submit, reset and button examples: 19button.html

PHP script: 19script.php

 

Sometimes inseted of text we can use an image.

Example with image: 20button_image.html

 

 

 

Button tag attributes

1. name="string"

2. value="string"

The pair name-value will be sent to the PHP script.

Example with name-value pair in button tag: 21button_name-value.html

PHP script: 21script.php

 

3. type="button | submit | reset"

 Defines the button behaviour.

 

 

Javascript onClick and onMouseOver events

Javascript onclick event can activate JS function on two ways:

a) put JS code inside <form action="javascript: fja()">

Example: 22button_js1.html

 

b) put JS code inside <button onclick="alert('You clicked me')">

Example1: 22button_js2.html

Example2: 22button_js3.html

 

 The same thing is with onmouseover.

Onmousewover: 22button_js_onmouseover.html