2
なぜ私のonclickは以前に実行されたjs関数をオーバーライドしませんか?この関数は、PHPのエコー内からトリガされます。関数が実行され、イメージとその幅と高さが変更されます。後で私のボタンをクリックすると、イメージが再び変化しますが、イメージだけが変化し、幅と高さは変わりません。いくつかのPHP内部 なぜ私のonclickは先に実行されたjs関数をオーバーライドしませんか?
<script>
function helmfunc() {
document.getElementById("helmplace").src = "helmimg/s_helmet.png"; //executes
document.getElementById("helmplace").style.width = "22px"; //executes
document.getElementById("helmplace").style.height = "31px"; //executes
}
</script>
<img id="helmplace" name="showh" src="redx3.png" width="25" height="30" />
<span onclick="showh.src = x_helm.src; showh.width = x_helm.width; showh.height = x_helm.height; helm.value = 'x helm'">
<il>
<img id="xhelmid" name="x_helm" src="helmimg/x_helmet.png" width="22" height="31" />x Helm
</il>
</span>
:(遠い体内でダウン)の代わりにイベントリスナーを使用している、onclickをクリック上のコードを実行するために、一般的に受け入れられる方法を使用しての
echo '<script type="text/javascript"> slayerhelmfunc(); </script>';
イベントリスナーの代わりに、onclickのを使用してください。 –
yupが今働いていて、これほど長い間これに執着していたことがちょっとばかげていた:P –
@ThomasJuranek働いているようだから、あなたのコメントを答えに変えてアップアップして受け入れることができますか? – techturtle