如何决定基于对使用JavaScript网页上的日期值显示哪个形象? [英] How to decide which image to show based on a date value on a webpage using JavaScript?

查看:137
本文介绍了如何决定基于对使用JavaScript网页上的日期值显示哪个形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我显示上文字的字段每一行的日期值的表,该行也有图标的空间,它要么显示一个红色的图标,如果日期是过时的,或者绿色的图标,如果日期是确定的,我显示的日期值来自数据库,我想要做的是显示基于与在桌子上,今天的日期的日期比较两种图标。因此,如果在表上的日期是2012年10月14日,今天是在同一天,图标将是绿色的,如果在表上的日期是2012年10月10日或任何其他日期之前今天的日期,它具有可显示红色图标。
我几乎一无所知JavaScript,但我认为这是什么,我需要这个,两个图像已经存储在服务器上,而我在VB.NET ASP的发展。

I have a table in which I display a date value on each row on Literal fields, the row also has a space for an icon, it has to either display a red icon if the date is outdated, or a green icon if the date is ok, the date value I'm displaying comes from a database, what I want to do is to show either icon based on the comparison with the date on the table and today's date. So if the date on the table is 10/14/2012 and today is the same day, the icon will be green, if the date on the table is 10/10/2012 or any other date prior today's date, it has to display the red icon. I know almost nothing about JavaScript but I think it's what I need for this, both images are already stored on the server, and I'm developing on asp on VB.NET.

推荐答案

我已经使用jQuery的这个给你问什么看的链接code段工作

i have used jquery for this to work for what you asked see the link for the code snippet

http://jsfiddle.net/GbGVD/3/

这篇关于如何决定基于对使用JavaScript网页上的日期值显示哪个形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆