HTML DOM Source type Property Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The Source type Property in HTML DOM is used to set or return the value of the type attribute in a <source> element. The type attribute is used to specify the MIME type of the media resource. Syntax: It returns the Source type property. sourceObject.typeIt is used to set the Source type property.sourceObject.type = MIME_type Property Values: It contains a single value MIME_type which specifies the MIME_type of the media resource. A few MIME types are video/ogg, videomp4, audio/ogg etc. Return Value: It returns a string value that represents the MIME_type of the media resource. Example 1: This example returns the Source type Property. HTML <!DOCTYPE html> <html> <head> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM Source type property</h2> <audio controls> <source id="mySource" src="gameover.wav" type="audio/mpeg"> <source src="gameover.ogg" type="audio/ogg"> </audio> <p> Click the button to get the type of the audio file. </p> <button onclick="myFunction()"> Get Source type </button> <p id="demo"></p> <script> function myFunction() { let x = document.getElementById("mySource").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html> Output: Example 2: This example sets the Source type property. HTML <!DOCTYPE html> <html> <head> <style> body { text-align: center; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML DOM Source type property</h2> <audio controls> <source id="mySource" src="gameover.wav" type="audio/mpeg"> <source src="gameover.ogg" type="audio/ogg"> </audio> <p> Click the button to set the source type of the audio file. </p> <button onclick="myFunction()"> Set Source type </button> <p id="demo"></p> <script> function myFunction() { let x = document.getElementById("mySource").type = "audio/ogg"; document.getElementById("demo").innerHTML = "The source type has been changed to " + x; } </script> </body> </html> Output: Supported Browsers: Google ChromeFirefoxInternet ExplorerOperaSafari Comment More infoAdvertise with us Next Article HTML DOM Source type Property M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM Source src Property The Source src Property in HTML DOM is used to set or return the value of the src attribute in a <source> element. The src attribute is used to specify the URL of the media resource. Syntax: It returns the Source src property. sourceObject.srcIt is used to set the Source src property.sourceObj 2 min read HTML DOM Script type Property The DOM Script type Property is used to set or return the value of the type attribute of a <script> element. The type attribute is used to specify the MIME type of a script. and identify the content of the <script> Tag. It has a Default value which is "text/javascript". Syntax: It is use 2 min read HTML DOM Textarea type Property The Textarea type Property in HTML DOM is used to return the type of form element of the Textarea field. Note that, it will always return "textarea" for a Textarea Object. Syntax: textareaObject.type Return Value: It returns a string value that represents the type of form element of the Textarea fie 1 min read HTML DOM selection.type property The type property returns a String which describes the type of current selection. This is a read-only property. Syntax: selection.type Return Value: String describing the type of the selection. Possible return values are: None: No selection has currently been made.Caret: Only Clicked but not selecte 1 min read HTML DOM Source media Property The HTML DOM Source media Property is used to set or return the value of the media attribute of the <source> element. The <source> media attribute is used to accept any valid media query that would normally be defined in a CSS. This attribute can accept several values. Syntax: It is used 2 min read HTML | DOM Ol type Property The DOM Ol type Property is used to set or return the type attribute in an ordered list. This attribute defines which type(1, A, a, I and i) of order you want in your list numeric, alphabetic or roman numbers. Syntax: It is used to return the type property. olObject.type It is used to set the type p 2 min read HTML | DOM Link type Property The DOM Link type Property is used to set or return the content type or MIME type of the linked Document. For eg. text/css", "text/javascript", "image/gif", etc. Syntax: It returns the type property.linkObject.typeIt is used to set the type property.linkObject.type = MIME-type Property Values: It co 1 min read HTML DOM Script text Property The HTML DOM Script text Property is used to set or return the content of the <script> element. Syntax: It Returns the text property:scriptObject.textIt is used to set the text property:scriptObject.text = contents Property Values: It contains the value i.e contents that specify the content of 2 min read HTML DOM Input Text type Property The Input Text type Property in HTML DOM is used to return the type of form element of the text field. It always returns the text for an Input text field. Syntax:Â textObject.typeReturn Value: It returns a string value that represents the type of form element the input text field is. Below program i 1 min read Like