に問題がsetTimeout()
あると思います。
私のウェブページにアクセスして、私がどこにいるのかを確認できます: http://verbum.xtrweb/soon.php
問題は、2 つのテキスト フィールドがあることです。
- 「Verbum」と
id="Verbum"
- 「単一の検索を忘れる」
id="forget"
小さな辞書が落ちた後にフェードイン効果を適用したい(理解できるように、上記の私のサイトリンクを参照してください)。関数の名前と変数も変更しましたが、発生する唯一のことは、テキストの 1 つだけがフェードインすることであり、どちらが下にあるかの順序によって異なります。フェードインしないものは現れません。理解して見つけて答えていただければ幸いです。ありがとう。
<script type="text/javascript">
var opac = 0.0;
var alpha = 0;
function init() {
var elem = document.getElementById("Verbum");
elem.style.display = 'inline';
elem.style.filter = "alpha(opacity = " + alpha + ")";
elem.style.opacity = opac;
setTimeout("fadein()", 8500);
}
function fadein() {
var elem = document.getElementById("Verbum");
opac = opac + 0.1;
alpha = parseInt(opac * 100);
elem.style.opacity = opac;
elem.style.filter = "alpha(opacity = " + alpha + ")";
if (opac < 1.0) {
//Change the 50 to adjust the speed. The higher the number, the slower the fade
setTimeout("fadein()", 30);
}
}
window.onload=init;
</script>
2 番目の<script>
ブロックは次のとおりです。
<script type="text/javascript">
var opac = 0.0;
var alpha = 0;
function init() {
var eleme = document.getElementById("forget");
eleme.style.display = 'inline';
eleme.style.filter = "alpha(opacity = " + alpha + ")";
eleme.style.opacity = opac;
setTimeout("fadein()", 7500);
}
function fadein() {
var eleme = document.getElementById("forget");
opac = opac + 0.1;
alpha = parseInt(opac * 100);
eleme.style.opacity = opac;
eleme.style.filter = "alpha(opacity = " + alpha + ")";
if (opac < 1.0) {
// Change the 50 to adjust the speed. The higher the number, the slower the fade
setTimeout("fadein()", 30);
}
}
window.onload = init;
</script>