Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di nourdine
    Registrato dal
    Nov 2005
    Messaggi
    1,130

    onfocus su textarea che non parte

    non mi funziona sto codice. dovrebbe dare un alert al onfocus sul textarea .... boh?

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    
    <style type="text/css">
    body {background: #FFCCCC}
    
    textarea{
    	background: white;
    	height: 140px; width; 200px;
    	border: 1px solid #666;
    	padding: 2px;
    }
    </style>
    
    <script type="text/javascript">
    document.onload = function(){
    	var t_a = document.getElementById("shout");
    	t_a.onfocus = function(){
    		alert("ho preso il focus");
    		}
    	}
    </script>
    
    </head>
    
    <body>
    
    <form>
    <textarea id="shout">ccc</textarea>
    </form>
    
    
    
    </body>
    </html>

  2. #2
    Utente di HTML.it L'avatar di nourdine
    Registrato dal
    Nov 2005
    Messaggi
    1,130
    ah ! scusate ... ho scritto document.onload invece che window.onload

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.