は誰にも見ることができます:これを行うスクリプトを記述しようとしているif-elseステートメントが機能しないのはなぜですか?これが動作しない理由
<script>
if (url==showbasket.html||order1.html||order2.html||order3.html||order4.html) {
document.write('<span style="font-family:lucida;font-size:10px;">Hello</span>');
} else {
document.write('<span style="font-family:lucida;font-size:30px;">Hello Hello</span>');
}
</script>
- 私:
IF URL = 1.html or 2.html or 3.html or 4.html THEN
write option1
ELSE
write option2 (for all other URL´s)
'url'、' showbasket'、 'order1'、...はすべて未定義の変数です。私は 'showbasket.html'などは文字列でなければならないと仮定しているので、それらの周りに引用符を付ける必要があります。 「url」は何をすべきですか? –