| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 557 人关注过本帖
标题:这个代码怎么改写?????
只看楼主 加入收藏
binming776
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-10-7
收藏
 问题点数:0 回复次数:2 
这个代码怎么改写?????
</head>

<body>
<table width="1000" height="445" border="0" align="center">
  <tr>
    <td height="105">
    <img src="images/2.jpg" width="100" height="100" />
    <img src="images/0.jpg" width="100" height="100" />
    <img src="images/1.jpg" width="100" height="100" />
    <img src="images/0.jpg" width="100" height="100" />
    <img src="images/年.jpg" width="100" height="100" />
    <img src="images/1.jpg" width="100" height="100" />
    <img src="images/0.jpg" width="100" height="100" />
    <img src="images/月.jpg" width="100" height="100" />
    <img src="images/8.jpg" width="100" height="100" />
    <img src="images/日.jpg" width="100" height="100" /></td>  
  </tr>
</table>
</body>
</html>   

怎么实现这个日历随系统的时间变化而变化?  在线等,请大侠们解答下`````````
搜索更多相关主题的帖子: 代码 
2010-10-09 19:38
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:0 
程序代码:
<%dim curtime,nowdate,
curtime=date()
nowdate=year(curtime)&""&month(curtime)&""&day(curtime)&""
response.write "<table width="1000" height="445" border="0" align=""center"">"
response.write "<tr><td height=""105"">"
for i=1 to len(nowdate)
str=mid(nowdate,i,1)
response.write "<img src='images/"&str&".jpg' width=""100"" height=""100"" />"
next
response.write "</td></tr></table>"
%>

QQ:63572063
2010-10-09 22:03
luoye820116
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2010-10-10
收藏
得分:0 
public class ValidCode : IHttpHandler
{
    //添加生成验证码的随机函数
    private string GetValidCode(int num)
    {

        string strRandomCode = "ABCD1EF2GH3IJ4KL5MN6P7QR8ST9UVWXYZ";                                //定义要随机抽取的字符串
        char[] chastr = strRandomCode.ToCharArray();                                                //将定义的字符串转成字符数组
        StringBuilder sbValidCode = new StringBuilder();                                            //定义StringBuilder对象用于存放验证码
        Random rd = new Random();                                                                   //随机函数,随机抽取字符
        for (int i = 0; i < num; i++)
        {
            //以strRandomCode的长度产生随机位置并截取该位置的字符添加到StringBuilder对象中
            sbValidCode.Append(strRandomCode.Substring(rd.Next(0, strRandomCode.Length), 1));
        }
        return sbValidCode.ToString();

    }
   
    //生成验证码
   
    public void ProcessRequest (HttpContext context)
    {
        string strValidCode = GetValidCode(5);                                                  // 产生5位随机字符
        context.Session["ValidCode"] = strValidCode;                                            //将字符串保存到Session中,以便需要时进行验证
        Bitmap image = new Bitmap(120, 30);                                                     //定义宽120像素,高30像素的数据定义的图像对象
        Graphics g = Graphics.FromImage(image);                                                 //绘制图片
        try
        {

            Random random = new Random();                                                       //生成随机对象
            g.Clear(Color.White);                                                               //清除图片背景色
            for (int i = 0; i < 25; i++)                                                        // 随机产生图片的背景噪线
            {
                int x1 = random.Next(image.Width);
                int x2 = random.Next(image.Width);
                int y1 = random.Next(image.Height);
                int y2 = random.Next(image.Height);
                g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
            }

            Font font = new System.Drawing.Font("新宋体", 20, (System.Drawing.FontStyle.Bold));  //设置图片字体风格
            LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 3, true);//设置画笔类型
            g.DrawString(strValidCode, font, brush, 5, 2);                                      //绘制随机字符


            g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);    //绘制图片的前景噪点
             ms = new ();                           //建立存储区为内存的流
            image.Save(ms, ImageFormat.Gif);                                                    //将图像对象储存为内存流
            context.Response.ClearContent();                                                    //清除当前缓冲区流中的所有内容
            context.Response.ContentType = "image/Gif";                                         //设置输出流的MIME类型
            context.Response.BinaryWrite(ms.ToArray());                                         //将内存流写入到输出流
        }
        finally
        {
            g.Dispose();
            image.Dispose();
        }
    }
 
    public bool IsReusable
    {
        get {
            return false;
        }
    }

}
我写的这段代码运行时 context.Session["ValidCode"] = strValidCode;位置提示System.NullReferenceException错误,怎么改
2010-10-10 15:33
快速回复:这个代码怎么改写?????
数据加载中...
 
   



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

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