11548 sujets

JavaScript, DOM et API Web HTML5

Bonjour ,
je suis archi nulle en javascript c'est pourquoi je viens vous demander votre aide.
Jesouterai transformer la fonction pour que au lieu de mettre une colors ça mette le fond d'une image .J'ai essayé en changeant tout bettement #974C08 par image.jpg mais ça ne marche pas.
Savez vous comment faire ?
voila mon code :
function colorIt(tditem)
	{
	if(document.all)
		{
			document.all.td0.style.background='#974C08';
	document.all.td1.style.background='#974C08';
	document.all.td2.style.background='#974C08';
	document.all.td3.style.background='#974C08';
	document.all.td4.style.background='#974C08';
	document.all.td5.style.background='#974C08';
		tditem.style.background='#CC9933';
		}
else if(document.getElementById)
	{
			document.getElementById("td0").style.background='#993300';
	document.getElementById("td1").style.background='#993300';
	document.getElementById("td2").style.background='#993300';
	document.getElementById("td3").style.background='#993300';
	document.getElementById("td4").style.background='#993300';
	document.getElementById("td5").style.background='#993300';
tditem.style.background='CC9933';
	}
}

Modifié par laloote (23 Feb 2005 - 16:32)
(...)
document.all.td0.style.background='[#red][b]url(image.jpg)[/b][/#]';
(...)

Non ? Essaie !

@+, HoPHP
Modifié par HoPHP (23 Feb 2005 - 16:41)