برنامه ای که کاربر با کلیک روی یک باتن مطالب جدیدی در پاراگراف مشاهده میکند .
<html>
<head>
<script>
function test()
{
alert("test shod");
p1.innerText="matn jadid"
if (text1.value==NULL || text1.value=="")
hide1.value="Error"
window.hide1.attributes
}
</script>
</head>
<body>
<p id=p1> this is a paragraph</p>
<br>
<input type=TEXT NAME=text1><input type=hidden NAME=hide1>
<br>
<input type=button onclick=test()>
<br>
</body>
</html>