:master: il codice di sotto SEMBRA funzionare. Spero che lo guardino altri per eventualmente correggerlo.
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> <title>Pagina senza titolo</title> <script language="javascript" type="text/javascript"> // <!CDATA[ function window_onload() { var immagini = document.images; for(var i = 0; i < immagini.length; i++) { var immagine = immagini[i]; var src = immagine.src; if(Right(src, 4).toLowerCase() == ".jpg") { var a = document.createElement("a"); a.setAttribute("href", src); a.setAttribute("target", "_blank"); immagine.parentNode.insertBefore(a, immagine); a.appendChild(immagine); } } } function Right(str, n) /*** IN: str - the string we are RIGHTing n - the number of characters we want to return RETVAL: n characters from the right side of the string ***/ { if (n <= 0) // Invalid bound, return blank string return ""; else if (n > String(str).length) // Invalid bound, return return str; // entire string else { // Valid bound, return appropriate substring var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } // ]]> </script> </head> <body onload="return window_onload()"> [img]../immagini/CapoPecora.JPG[/img] [img]../immagini/pulsanteplus.gif[/img] [img]../immagini/Sfumato_verticale_celeste_bianco.bmp[/img] </body> </html>

Rispondi quotando