Ciao a tutti,
avrei bisogno di un sugerimento a riguardo di un codice che vorrei realizzare..
ma mi sono ritrovato con due enormi problemi.. il primo quello più semplice
ho notato che la funzione removeNode
document.getElementById(idelemento).removeNode(ide lemento);
su firefox non funziona per niente
e avrei bisogno di sostituirla con qualcosa che vada bene su più browser
mentre il secondo problema... e che l'animazione non funziona proprio xD
questo è il mio tentativo spero che qualcuno noti il problema perchè ci sto perdendo la testa ahahah
grazie e spero che qualcuno abbia la pazienza di leggere ^^codice:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>boh</title> <script> function rimuoviDiv(idelemento) { document.getElementById(idelemento).removeNode(idelemento); } function createmenu() { var newDive; newDive = document.createElement('accountid'); newDive.id = 'accountid'; newDive.className = 'dd'; newDive.setAttribute("width", "197px;"); document.getElementById('body').appendChild(newDive); var newimg = document.createElement("img"); newimg.id = "img1"; newimg.setAttribute("src","http://www.puntocellulare.it/notizie-img/ITT-Outlimits-DSS-1_23350_01.jpg"); newimg.setAttribute("width", "197px;"); newimg.setAttribute("height", "100%"); newDive.appendChild(newimg); animazione(); } function cancella() { rimuoviDiv('accountid'); rimuoviDiv('img1'); } var velocit = 1; var apry = 0; function animazione() { for( apry; apry < 100; apry++) { var elem = document.getElementById("accountid"); elem.style.height = apry+'%'; var img = document.getElementById("img1"); img.style.height = apry+'%'; sleep(20); } } function sleep(milliseconds) { var start = new Date().getTime(); for (var tmp = 0; tmp < 1e7; tmp++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } </script> <style type="text/css"> body { background-color: #666; } .dd { width: 197px; } </style> </head> <body class="body"> <input name="ss" type="button" value="ciaociccione" onclick="createmenu();"/> </body> </html>

Rispondi quotando
