Set the Name of the Form Element in HTML

Jennifer Nicholas
Updated on 30-May-2020 23:45:14

153 Views

Use the form attribute in HTML to set the name of the one or more form the element belongs to in HTML.ExampleYou can try to run the following code to implement the form attribute −                    SubjectID:          Subject Name:          Total Students:             Click    

Execute Script on Browser Window Resize in HTML

Daniol Thomas
Updated on 30-May-2020 23:28:32

306 Views

When the web browser window is resized, the onresize attribute triggers.ExampleYou can try to run the following code to implement onresize attribute −           Resize the window to trigger event.                function display() {             alert("Web browser window resized!");          }          

Execute a Script on Mouse Pointer Over an Element in HTML

usharani
Updated on 30-May-2020 23:25:36

385 Views

The onmouseover attribute triggers when a mouse pointer moves over an element in HTML.ExampleYou can try to run the following code to implement onmouseover attribute −                    This is demo heading.             Keep the mouse cursor on the heading to change the color.                function display() {             document.getElementById("myid").style.color = "red";          }          

Display an Image in HTML

Nitya Raut
Updated on 30-May-2020 23:01:27

9K+ Views

Use the tag in HTML to display an image. The following are the attributes −AttributeValueDescriptionAligntopbottommiddleleftrightDeprecated− Specifies the alignment for the image.AlttextSpecifies alternate textBorderpixelsDeprecated − Specifies the width of the image border.crossorigin anonymous use-credentialsIt allows images from third-party sites that allow cross-origin access to be reused with canvas.Heightpixels or %Specifies the height of the image.hspacepixelsDeprecated − Amount of white space to be inserted to the left and right of the object.IsmapURLDefines the image as a server-side image map.LongdesctextDeprecated − Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute.SrcURLthe url ... Read More

Add a Single Line Input Field in HTML

Anvi Jain
Updated on 30-May-2020 22:59:17

721 Views

Use the tag to add a single-line input field. The HTML tag is used for querying a document through a text field. The tag can be used anywhere but head tag is preferable. Note: It is a deprecated tag and should not be used.The following are the attributes −AttributeValueDescriptionPromptstringLabel for the text fieldActionURLused when a query needs to be sent to a different URLExampleTry the following code −           HTML isindex Tag          

Execute Script on Mouse Wheel Scroll in HTML

Nikitha N
Updated on 30-May-2020 22:58:31

368 Views

When a mouse wheel is being scrolled over an element, the onwheel attribute triggers.ExampleYou can try to run the following code to execute a script when a mouse wheel is being scrolled over an element in HTML −                   This is demo text. Roll the mouse wheel here.                function display() {             alert("Mouse Wheel used!");          }          

Execute a Script When Media is Ready to Start Playing in HTML

Sreemaha
Updated on 30-May-2020 22:50:00

181 Views

Use the oncanplay attribute to define when an audio/ video is ready to start playing.ExampleYou can try to run the following code to learn how to execute a script when the media is ready to start playing −                                        Your browser does not support the video element.                      function display() {             alert("Video loaded!");          }          

Execute a Script When Media Starts Playing in HTML

Ankith Reddy
Updated on 30-May-2020 22:48:38

143 Views

Use the onplaying attribute to let users know that the audio/ video started playing.ExampleYou can try to run the following code to learn how to execute a script when the media has started playing −                                        Your browser does not support the video element.                      function display() {          alert("Video started playing!");          }          

Execute Script on Window History Changes in HTML

Srinivas Gorla
Updated on 30-May-2020 22:47:57

198 Views

When the window’s history change, the onpopstate event triggers. You can add it like this −Example           This is demo text    

Execute Script for Context Menu in HTML

Govinda Sai
Updated on 30-May-2020 22:16:07

155 Views

When a element is shown as a context menu in HTML, the onshow event fires.ExampleYou can try to run the following code to execute a script when a element is displayed as a context menu −           HTML menu                        Right click inside here....                                                                                          function display() {             alert("The context menu will be visible now.");          }          

Advertisements