标题:javascript如何改字体颜色
只看楼主
akilifan
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-7-27
结帖率:0
已结贴  问题点数:20 回复次数:3 
javascript如何改字体颜色
<script language="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))
}
function deleteCookie(name, path, domain) {
        if (getCookie(name)) {
                document.cookie = name + "=" +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT"
        }
}
function fixDate(date) {
        var base = new Date(0)
        var skew = base.getTime()
        if (skew > 0)
                date.setTime(date.getTime() - skew)
}
var now = new Date()
fixDate(now)
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)
var visits = getCookie("counter")
if (!visits)
        visits = 1
else
        visits = parseInt(visits) + 1
setCookie("counter", visits, now)
document.write("漫步的鱼欢迎您的第" + visits + "次光临!")
// -->
</script>

请问上面的代码怎么把“漫步的鱼欢迎您的第N次光临”改成红色,还是菜鸟,希望知道的帮帮忙
搜索更多相关主题的帖子: javascript 字体 颜色 
2010-07-27 20:43
zmh886
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:238
专家分:1305
注 册:2010-6-2
得分:6 
document.write("<font color=red>漫步的鱼欢迎您的第" + visits + "次光临!</font>")

没有试过 应该差不多。

http://www./
2010-07-27 21:30
ztslove
Rank: 1
来 自:北京
等 级:新手上路
帖 子:19
专家分:7
注 册:2010-5-27
得分:6 
程序代码:
document.write("<font color='red'>" + "漫步的鱼欢迎您的第" + visits  + "次光临!" + "</font>");



这样是可以的 我试过了
2010-08-01 11:56
努力加油
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:34
专家分:127
注 册:2010-4-11
得分:6 
回复 3楼 ztslove
怎么样 现在研究的
2010-08-01 13:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-314104-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.216062 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved