Javascript: Modificare elementi pagina Parte 2

Mettiamo questa volta, di voler modificare l’attributo delle dimensioni di un div, al solo passaggio del mouse, Ecco il codice:

 
script language="Javascript"
!--
function cambiadim(h,w)
{
document.getElementById('par1').style.height = h + 'px';
document.getElementById('par1').style.width = w + 'px';
}
--
/script
 
div id="par1" 
style="height: 10px; width: 10px; background-color: #FF0000" 
OnMouseOver="cambiadim(100,100)"
/div

Articoli simili

Lascia un commento

Your email is never published nor shared. Required fields are marked *

*
*

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a