<< Click to Display Table of Contents >> Métodos e Eventos |
![]() ![]() ![]() |
Métodos
window.open('http://www.google.com');
window.print();
Eventos
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<script>
function evento() {
window.open('http://www.google.com');
}
</script>
<body onload="evento()">
</body>
</html>
Evento - outro exemplo
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<script>
function evento() {
if (confirm('Abrir a nova aba com Google?'))
window.open('http://www.google.com');
}
</script>
<body>
<form id="forma1" method="post">
<input id="Button1" type="button" value="Trocar titulo" onclick="evento()" />
</form>
</body>
</html>