奇怪的难题:一段JS代码,无法设置其字体大小及颜色
·
前几天遇到一个难题,就是网上找到一段计数编号代码,想给它增加调节编号功能,一个网友虽然解决了此问题,但其改编后的代码,却又出现奇怪的现象,就是无法设置字体大小及颜色,此问题我还是第一次遇到。所以再求高手帮忙。另外,我曾想把那“加”“减”放在编号前面,想尽了办法,奇怪的是以前随心所欲办到的事,对这段代码却变成了无计可施。真不知是什么原因。大家试试看(把下边的代码复制到记事本上,后辍txt改为html,并用IE打开看看,然后试着改,看行不行?)。代码如下:
<HEAD>
<style type="text/css">body{margin-top: 0px; }</style>
</HEAD>
<TD ALIGN="right"><FONT style="FONT-SIZE: 28pt; FONT-FAMILY: 宋体,"><font color="red"><script type="text/javascript">
var caution = false;
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "") ;
if (!caution || (name + "=" + escape(value)).length <= 4000)
document.cookie = curCookie
else
if (confirm("Cookie exceeds 4KB and will be cut!"))
document.cookie = curCookie
}
function getCookie(name) {
var prefix = name + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) &