我有以下代码(在 Rocket Themed Joomla 站点中),当我添加最后一个标签时,我似乎无法让 Javascript 删除换行符。这是脚本:
<head>
<script type="text/javascript">
var d = new Date();
var date = d.getDate();
var day = d.getDay();
function schoolDay5(){
//weekNo = Math.ceil(date/7); //See bottom of the page to see how it works
if (date%2 == 0)
return 2;
else
return 1;
}
window.onload=function(){
var str= "<span class='promo1 ribbon'>" + "Welcome to Stephen Leacock it is day " + schoolDay5()+ "<span>";
document.getElementById('notice').innerHTML=str;
}
</script>
</head>
<body>
<div id="notice"></div>
</body>
当我运行它时,我在最后一个标签上得到一个新行。我怎样才能让这个脚本吐出一行?
这是显示结果的页面:现在的样子