Visualizzazione dei risultati da 1 a 3 su 3

Discussione: caricamento immagine

  1. #1

    caricamento immagine

    Salve,

    volevo sapere se era possibile mostrare un'immagine solo alla fine del caricamento di essa, voglio evitare di vedere l'immagine mentre si forma...

    grazie
    Alla batteria dai retta ballA

  2. #2
    questo è il codice della pagina in questione...ogni 20 secs carica una nuova immagine dal server ma vorrei che l'ultima immagine prendo sia visibile (prenda il posto della precedente) solo quando è stata caricata completamente:

    codice:
    <html>
    <head>
    <title>::NaioSPy::</title>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    <script language="javascript1.2" type="text/javascript">
    <!--
    
    function prendiElementoDaId(id_elemento) {
    	var elemento;
    	if(document.getElementById)
    		elemento = document.getElementById(id_elemento);
    	else
    		elemento = document.all[id_elemento];
    	return elemento;
    };
    
    function LoadXMLDoc(url) {
    	// branch for native XMLHttpRequest object
    	if (window.XMLHttpRequest) {
    		req = new XMLHttpRequest();
    		req.onreadystatechange = processReqChange;
    		req.open("GET", url, true);
    		req.send(null);
    	// branch for IE/Windows ActiveX version
    	} else if (window.ActiveXObject) {
    		isIE = true;
    		req = new ActiveXObject("Microsoft.XMLHTTP");
    		if (req) {
    			req.onreadystatechange = processReqChange;
    			req.open("GET", url, true);
    			req.send();
    		}
    	}
    };
    
    function processReqChange() {
    	// only if req shows "loaded"
    	if (req.readyState == 4) {
    	// only if "OK"
    		if (req.status == 200) {
    		// ...processing statements go here...
    
    		prendiElementoDaId('naietto').innerHTML = req.responseText;
    
    		} else {
    			alert(req.statusText);
    		}
    	}
    };
    
    function LoadIMG() {
    	
    	url = "naiospy.cgi?action=newimage";
    	LoadXMLDoc(url);
    
    };
    
    function MainStart() {
    
    	LoadIMG();
    	window.setInterval('LoadIMG()', 20000);
    }
    
    //-->
    </script>
    <style type="text/css">
    <!--
    
    body {
    	margin: 5px;
    	padding: 5px;
    	background: #ccc;
    }
    
    a {
    	color: blue;
    	font: 15px Arial;
    }
    
    a:visited {
    	color: blue;
    }
    
    a:hover {
    	color: red;
    }
    
    div#naietto {
    	width: 800px;
    	height: 600px;
    	background: #eee;
    	border: 1px dashed #333;
    	padding: 5px;
    	margin: 10px;
    }
    
    h2 {
    	border: 1px dashed yellow;
    	background: #999;
    	padding: 5px;
    }
    
    div#navbar {
    	font: 13px Verdana;
    }
    
    //-->
    </style>
    </head>
    <body onLoad="MainStart();">
    <div id="navbar">
    	Index
    	<h2>::NaioSPy::</h2>
    	<div align="center">
    
    !!! LIVE !!! From: claudio [127.0.0.1]</p></div>
    </div>
    <div align="center">
    	<div id="naietto"></div>
    </div>
    </body>
    </html>
    Alla batteria dai retta ballA

  3. #3
    non riesco nemmeno a far funzionare questo codice:

    codice:
    <html>
    <head>
    <title>::NaioSPy::</title>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    <script language="javascript1.2" type="text/javascript">
    <!--
    
    var img = new Image();
    
    img.onload = function()
    {
    	var nd = document.getElementById("pic");
    	nd.src = this.src;
    }
    
    img.onerror = function()
    {
    	alert( "Immagine non caricata" );
    }
    
    img.src = "chef.jpg";
    
    //-->
    </script>
    </head>
    <body>
    
    <img id="pic" border="0" />
    
    </body>
    </html>
    l'src diventa undefined
    Alla batteria dai retta ballA

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.