1
在這裏我有一個HTML元素:如何在HTML加載javascript函數(span標記)
<h3>Current Date: <span id="spanDate"></span></h3>
我怎麼能(上)加載下面的跨度標籤之間的功能
function aDate()
{
var d=new Date();
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
document.write(weekday[d.getDay()] + " ");
document.write(d.getDate() + ". ");
document.write(monthname[d.getMonth()] + " ");
document.write(d.getFullYear());
}
謝謝!
喜歡這個? http://jsfiddle.net/QBsWy/ – PSL
@PSL - 嵌入式JavaScript? EW。 – j08691
@ j08691:D .....他正在使用document.write ... :)試試這種方式,http://jsfiddle.net/9Bnkc/ – PSL