jam Posted June 28, 2007 Report Share Posted June 28, 2007 Sveiki. Man ir šāda Javascript funkcija: function efektson(ref){ if (ref==3) { document.getElementById("proColor7").style.backgroundImage='url("http://www.drr.lv/img/bilde8_color.gif")'; } } HTML rakstu: <a onmouseover="efektson(3)" onmouseout="XXX" href="#">Mainu krāsu citam ID</a> Uz mouseover tam linkam skripts pamaina background-image citam elementam ar ID=proColor7. Problēma tāda, ka man uz onmouseout vajag, lai proColor7 atgriežas iepriešējā stāvoklī- atpakaļ vecais background. Kā to panākt? Paldies! Link to comment Share on other sites More sharing options...
andrisp Posted June 28, 2007 Report Share Posted June 28, 2007 document.getElementById("proColor7").style.backgroundImage = ''; vajadzētu līdzēt. Un jebkurā gadijumā tu taču vari darīt arī šādi: document.getElementById("proColor7").style.backgroundImage='url("http://www.drr.lv/img/vecais_backgrounds.gif")'; Link to comment Share on other sites More sharing options...
jam Posted June 28, 2007 Author Report Share Posted June 28, 2007 Tās pašas fukcijas ietvaros to var realizēt kaut kā? Nu tipa, izsaucot ar <a onmouseover="efekts(3,'on')" onmouseout="efekts(3,'off')" href="#">Mainu krāsu citam ID</a> ja ir ON, tad mainās backround uz jauno, ja OFF, tad cancelējas maiņa. Link to comment Share on other sites More sharing options...
andrisp Posted June 28, 2007 Report Share Posted June 28, 2007 if ('on') { // bla bla } elseif ('off') { // bla bla } ? Link to comment Share on other sites More sharing options...
jam Posted June 28, 2007 Author Report Share Posted June 28, 2007 Tā es arī izdomāju jau pats. paldies! Link to comment Share on other sites More sharing options...
Recommended Posts