String Object's Length, Document.Location Properties, confirm and input dialog
<HTML>
<HEAD>
<TITLE>Properties</TITLE>
</HEAD>
<BODY>
<SCRIPT>
var theString = new String();
theString = prompt("Enter a string: ","");
document.write('The string "' + theString + '" is ' + theString.length + ' characters long.');
if (window.confirm("Do you want to go to Java2s today?"))
window.location = "http://www.java2s.com";
</SCRIPT>
</BODY>
</HTML>
Related examples in the same category