注册 登录
编程论坛 ASP技术论坛

感觉真的是老了,这么简单效果都编不出来...

sass2008 发布于 2008-05-27 10:45, 712 次点击
比如一个字符串 357
编一个程序实现显示34567,但其中的357用红色表示,其它用黑色
如果字符串为57,则 显示 567,其中的57也显示红色,共它为黑
如果字符串为127 则显示1234567 其中的127为红色.
大家知道我的意思了吗?就是根据首位数字生成到7的字符串,但出现的字符用红色表示.
我下面的代码就只能显示第一位为红色,怎么改都不成.
<%
a="357"
N=1
for b=3 to 7
' response.write mid(a,N,1) & "--" & b & "<BR>"
  if mid(a,N,1)=trim(b) then
  response.write "<font color=red>" & b & "</font>"
  else
  response.write b
  end if
N=N+1
next
%>
9 回复
#2
fatring2008-05-27 10:53
呵.没事..慢慢来
#3
sass20082008-05-27 10:58
急着要这效果呀,大家快帮忙呀.....................
#4
sass20082008-05-27 11:35
继续顶........................................
#5
chzh222008-05-27 12:09
提示: 该帖被管理员或版主屏蔽,只有管理员可见
#6
flynet2008-05-27 12:32
回复 5# chzh22 的帖子
顶顶顶
#7
flynet2008-05-27 12:33
等下我给你写
在线么?
#8
flynet2008-05-27 12:37
a="17"
a1=left(a,1)
a2=right(a,1)
for i= a1 to a2
if instr(a,i)>0 then
response.Write "<font color=red>"
end if
response.Write i
if instr(a,i)>0 then
response.Write "</font>"
end if
next
#9
sass20082008-05-27 13:59
[bo][un]flynet[/un] 在 2008-5-27 12:37 的发言:[/bo]

a="17"
a1=left(a,1)
a2=right(a,1)
for i= a1 to a2
if instr(a,i)>0 then
response.Write ""
end if
response.Write i
if instr(a,i)>0 then
response.Write ""
end if
next



=======

谢谢,可能真的是年纪大了,一时脑子没有转过来!呵呵!
#10
flynet2008-05-27 16:09
呵呵 没什么的 估计你想的时候 心情太浮躁了呵呵
1