User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 374,158 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,453 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Help with Swapping Images onclick

Join Date: Apr 2008
Posts: 2
Reputation: rafael.franco is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rafael.franco rafael.franco is offline Offline
Newbie Poster

Re: Help with Swapping Images onclick

  #3  
Apr 11th, 2008
I've use it at website mega bonus. The code is very short and optimized, look:

function rede(num, acao, obj) {
	quadro = document.getElementById("quadro-exemplos");
	if(acao==1) {
		if(navigator.appVersion.indexOf("MSIE") != -1) {
			arrVersao = navigator.appVersion.split("MSIE"); 
			if (parseFloat(arrVersao[1]) < 7) obj.style.backgroundColor = "#f7fff6";
		}
		quadro.style.background = 'url(/images/loading.gif) center no-repeat';
		if(num == 1) quadro.innerHTML = '<img src="/images/exemplo-rede-pequena.gif" alt="Exemplo de Círculo de Relacionamento Pequeno" />';
		if(num == 2) quadro.innerHTML = '<img src="/images/exemplo-rede-media.gif" alt="Exemplo de Círculo de Relacionamento Médio" />';
		if(num == 3) quadro.innerHTML = '<img src="/images/exemplo-rede-grande.gif" alt="Exemplo de Círculo de Relacionamento Grande" />';
		if(num == 4) quadro.innerHTML = '<img src="/images/exemplo-rede-mega.gif" alt="Exemplo de Círculo de Relacionamento Mega" />';
	} else {
		if(navigator.appVersion.indexOf("MSIE") != -1) {
			arrVersao = navigator.appVersion.split("MSIE"); 
			if (parseFloat(arrVersao[1]) < 7) obj.style.backgroundColor = "#F8FCFF";
		}
		quadro.style.background = '';
		quadro.innerHTML = '<p>Passe o mouse sobre um dos exemplos à esquerda.</p>';
	}
}
Reply With Quote  
All times are GMT -4. The time now is 3:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC