Professional Documents
Culture Documents
Name Action Type Name Type Value : Form Input Input /form
Name Action Type Name Type Value : Form Input Input /form
var x = document.forms["myForm"]["fname"].value;
if (x == null || x == "") {
alert("Name must be filled out");
return false;
}
}
document.getElementById("demo").innerHTML = "Hello;
<p id=demo> </p>
Form validation:
Attribute
disabled
max
min
pattern
required
type
Object :
With the object model, JavaScript gets all the power it needs to create dynamic
HTML:
--<html>
<body>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script>
</body>
</html>
Description
document.getElementById(id)
document.getElementsByTagName(name)
document.getElementsByClassName(name)
Method
Description
element.setAttribute(attribute, value)
Description
document.createElement(element)
document.removeChild(element)
document.appendChild(element)
document.replaceChild(element)
document.write(text)
Description
document.getElementById(id).onclick = function()
{code}
Description
document.anchors
document.applets
document.baseURI
document.body
document.cookie
document.doctype
document.documentElement
document.documentMode
document.documentURI
document.domain
document.domConfig
document.embeds
document.forms
document.head
document.images
document.implementation
document.inputEncoding
document.lastModified
document.links
Returns all <area> and <a> elements that have a href attri
document.readyState
document.referrer
document.scripts
document.strictErrorChecking
document.title
document.URL
EVENT
<body onload="checkCookies()"
<button onclick="displayDate()">The time is?</button>
<script>
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
</script>
<p id="demo"></p>