J'ai une image qui est présentée après avoir survolé votre souris. Lorsque je clique sur l'image, je voudrais que l'image reste intacte en utilisant la méthode removAttr. Mais en utilisant removeAttr ne semble pas fonctionner pour moi .... merci pour toutes suggestions.en utilisant removeAttr ne fonctionne pas pour moi
Voici mon Balise HTML
<table class="ovalControl">
<tr>
<td class="oval">
</td>
<td class="ovalSibling" align="center" >
<div id="divOvalSibling" style="height:15px; width:30px;">
<img id="imgOvalSibling"
height="15px"
width="30px"
src="../Images/sib.PNG"
alt=""
onclick="respond0(); return false;"
style="display:none"/>
</div>
</td>
</tr>
<tr>
<td class="ovalChildWidth" align="center">
<div id="divOvalChild" style="height:25px; width:20px;">
<img id="imgOvalChild"
height="25px"
width="20px"
src="../Images/Child.PNG"
alt=""
onclick="respond1(); return false;"
style="display:none"/>
</div>
</td>
<td class="blank">
</td>
</tr>
</table>
Voici mon code JQUERY:
<script language="javascript" type="text/javascript">
var prmRegister = Sys.WebForms.PageRequestManager.getInstance();
prmRegister.add_initializeRequest(initializeRequest);
prmRegister.add_endRequest(endRequest);
$(document).ready(function() {
$('#divOvalSibling').hover(
function() {$('#imgOvalSibling').show();},
function() {$('#imgOvalSibling').hide();})
})
$(document).ready(function() {
$('#divOvalChild').hover(
function() { $('#imgOvalChild').show();},
function() { $('#imgOvalChild').hide();})
})
function initializeRequest(sender, args) {
}
function endRequest(sender, args) {
}
function respond0() {
var startX = $("#imgOvalSibling").offset().left + 15;
var startY = $("#imgOvalSibling").offset().top + 7;
$("#respond0").drawLine(startX, startY, 850, 250);
$("#imgOvalSibling").removeAttr("style");
}
function respond1() {
var startX = $("#imgOvalChild").offset().left + 10;
var startY = $("#imgOvalChild").offset().top + 12;
$("#respond1").drawLine(startX, startY, 400, 500);
$("#imgOvalChild").removeAttr("style");
}
</script>
Merci, Michael
Qu'est-ce que vous essayez d'atteindre? Je doute que vous puissiez supprimer tout l'attribut "style" de cette façon, parce que c'est spécial. – Pointy
Je veux juste que l'image reste affichée, surtout après avoir cliqué sur l'image. – MdeVera