<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>last.html</title>
<style>
</style>
<script type="text/javascript">
Date.prototype.diff = function (date)
{
return (this.getTime () - date.getTime ()) / (24 * 60 * 60 * 1000);
}
onload = function ()
{
var now = new Date ('2015/02/19 00:00:00');
var date = new Date ();
var diff = now.diff (date);
document.getElementById ('end2').innerHTML = Math.floor (diff);
}
</script>
</head>
<body>
距过年
<span id="end2"></span>天
</body>
</html>
想给span 添加样式color:#a00000; font-size:20px; font-weight:700; 怎么做?
直接加么,,,我刚才试怎么不行,把你的复制下来就行了,,无语,,给分了。
追答或者 <span id="end2" style="color:#a00000; font-size:20px; font-weight:700;不灵,放到什么 地方?
追答你有没有引入jquery啊
如果没有就得用JS
var obj=document.getElementById("#end2");\
obj.style.color="#a00000";
obj.style.fontSize="20px";
obj.style.fontWeight="700";