/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: name

[this page | pdf | back links]

The HTML name attribute generally specifies the name of an element. It applies to <button>, <fieldset>, <form>, <iframe>, <input>, <keygen>, <map>, <meta>, <object>, <output>, <param>, <select> and <textarea> elements.

 

Valid attribute values (when used with <button>, <fieldset>, <form>, <iframe>, <input>, <keygen>, <object>, <output>, <select> and <textarea> elements) include:

 

Value

Description

name

Name for element or associated element

 

Valid attribute values (when used with <map> elements) include:

 

Value

Description

name

Name associated with the <img> element’s usemap attribute that creates a relationship between the image and the map

 

Valid attribute values (when used with <meta> elements) include:

 

Value

Description

application-name

Name of web application to which page is associated

author

Author of document

description

Description of page (often picked up by search engines to show with results of searches)

generator

One or more software packages that have generated the document

keywords

A comma-separated list of keywords relevant to the page (again helpful for search engines). Specifying this piece of metadata helps with search engine optimisation

viewport

Information about the viewport, i.e. the window in which the user sees the webpage. For example, it is common to include the following element in webpages to improve their viewability across different devices:

 

<meta name="viewport" content="width=device-width, initial-scale=1.0">

 

The width=device-width part of the content attribute indicates that the width of the page should adapt to the screen width, and the initial-scale=1.0 part identifies the initial zoom level used when the page is first loaded into the browser.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<form action="http://www.nematrian.com/ExpressionEvaluator.aspx">
<input type="radio" name="expr" value="3*5">3*5</input><br>
<input checked type="radio" name="expr" value="5*exp(1)*max((1,2,3))">5*exp(1)*max((1,2,3))</input><br>
<input type="submit" value="Go to webpage to evaluate">
</form>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var f = document.createElement("FORM");
f.setAttribute("action","http://www.nematrian.com/ExpressionEvaluator.aspx");
var x1 = document.createElement("INPUT");
x1.setAttribute("type","radio");
x1.setAttribute("name","expr");
x1.setAttribute("value","3*5");
var txt1 = document.createTextNode("3*5");
var x2 = document.createElement("BR");
var x3 = document.createElement("INPUT");
x3.setAttribute("type","radio");
x3.setAttribute("checked","checked");
x3.setAttribute("name","expr");
x3.setAttribute("value","5*exp(1)*max((1,2,3))");
var txt3 = document.createTextNode("5*exp(1)*max((1,2,3))");
var x4 = document.createElement("BR");
var x5 = document.createElement("INPUT");
x5.setAttribute("type","submit");
x5.setAttribute("value","Go to webpage to evaluate");
f.appendChild(x1);
f.appendChild(txt1);
f.appendChild(x2);
f.appendChild(x3);
f.appendChild(txt3);
f.appendChild(x4);
f.appendChild(x5);
document.getElementById("element").appendChild(f);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile