标题:asp怎么批量随机修改数据字体样式?
只看楼主
sunfeiyao
Rank: 1
等 级:新手上路
帖 子:68
专家分:0
注 册:2011-9-7
结帖率:12.5%
 问题点数:0 回复次数:1 
asp怎么批量随机修改数据字体样式?
asp怎么批量随机修改数据字体样式?

如原数据库:
ID                           标题                       样式
1                           aaaaa                       ,
2                           bbbbb                       ,
3                           ccccc                       ,
4                           ddddd                       ,
5                           eeeee                       ,
等。。。。

指定修改ID段 为3—100批量执行后  随机修改某个记录样式为字体,颜色  修改率为 大概每5个记录随机修改1个记录(注:有的只添加颜色,有的只添加字体,有的字体颜色都添加)

更新后:
ID                           标题                       样式
1                           aaaaa                       ,
2                           bbbbb                       ,
3                           ccccc                       粗体,红色
4                           ddddd                       粗体,
5                           eeeee                       ,蓝色
等。。。。

求高手 给段代码 带注解那种  谢谢
搜索更多相关主题的帖子: 记录 aaaaa ccccc eeeee 
2012-11-30 10:53
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
得分:0 
试试看下面的代码,因为随机概率的缘故,不是很平均
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.blue { color:#0000FF; }
.blueB { color:#0000FF; font-weight:bold; }
.red { color:#FF0000; }
.redB { color:#FF0000; font-weight:bold; }
.green { color:#009900; }
.greenB { color:#009900; font-weight:bold; }
-->
</style>
</head>

<body>
<%
classArray = array("blue","blueB","red","redB","green","greenB")    '样式数组
dim dataArray(11)     '数据数组(供演示用,你可以从数据库中取)
dataArray(0) = "aaaaaaaaaa"
dataArray(1) = "bbbbbbbbb"
dataArray(2) = "cccccccccc"
dataArray(3) = "dddddddddd"
dataArray(4) = "eeeeeeee"
dataArray(5) = "fffffffffff"
dataArray(6) = "gggggggggggggg"
dataArray(7) = "hhhhhhhhhhhh"
dataArray(8) = "iiiiiiiiiii"
dataArray(9) = "jjjjjjjjjjjj"
dataArray(10) = "kkkkkkkkk"
dataArray(11) = "zzzzzzzzzzzz"

for i=0 to ubound(dataArray)
    Randomize
    k = int(100*Rnd)
    if k<25 then    '这里25%的概率
        Randomize
        c = int((ubound(classArray)+1)*Rnd)        '随机class
        Response.Write("<div class="""&classArray(c)&""">"&dataArray(i)&"</div>")
    else
        Response.Write("<div>"&dataArray(i)&"</div>")
    end if
next

 %>
</body>
</html>


 

----我怎能在别人的苦难面前转过脸去----
2012-12-01 14:44



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




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

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