我編寫了這個腳本,但它只適用於我沒有廣告class="yes"
,但如果iI添加它,它不會工作,這是什麼原因。謝謝。
這工作:將CSS類添加到div
<script type="text/javascript">
var d=new Date();
var weekday=new Array(7);
weekday[0]="<div>Sunday</div>";
weekday[1]="<div>Monday</div>";
weekday[2]="<div>Tuesday</div>";
weekday[3]="<div>Wednesday</div>";
weekday[4]="<div>Thursday</div>";
weekday[5]="<div>Friday</div>";
weekday[6]="<div>Saturday</div>";
document.write("Today is " + weekday[d.getDay()]);
</script>
這不起作用
<script type="text/javascript">
var d=new Date();
var weekday=new Array(7);
weekday[0]="<div class="yes">Sunday</div>";
weekday[1]="<div class="yes">Monday</div>";
weekday[2]="<div class="yes">Tuesday</div>";
weekday[3]="<div class="yes">Wednesday</div>";
weekday[4]="<div class="yes">Thursday</div>";
weekday[5]="<div class="yes">Friday</div>";
weekday[6]="<div class="yes">Saturday</div>";
document.write("Today is " + weekday[d.getDay()]);
</script>