第一个JS问题
<input id="bid" value="5000">
<input id="reserve_price" value="750.00">
<script>
$$=function(id){
return document.getElementById(id);
}
var error='';
if($$("bid").value.replace(/^\s+/,"").replace(/\s+$/,"")<$$("reserve_price").value){
error+="Your bid must be equal to or higher than the reserve price\n";
}
alert($$("bid").value.replace(/^\s+/,"").replace(/\s+$/,""));
alert($$("reserve_price").value);
alert(error);
</script>你们认为这写法对吗?认为对的请运行程序看看,娃哈哈。。第二个数据库问题。
数据表名称product
id  int(4)
name  varchar(20);
price  text有2条记录
id   name    price
1    电视机  750.00
2    空调    5000按价格高低排序出来
写sql语句
select * from product order by price desc认为对的请运行看看,

解决方案 »

  1.   

    首先,我不会把价格字段用text存储,因此不会有这个错误。
      

  2.   

    if($$("bid").value.replace(/^\s+/,"").replace(/\s+$/,"")<$$("reserve_price").value)
    应为
    if(parseFloat($$("bid").value)<parseFloat($$("reserve_price").value))select * from product order by price desc
    应为
    select * from product order by price+0 desc
    或将 price 改为 DECIMAL 类型
      

  3.   

    再有 .replace(/^\s+/,"").replace(/\s+$/,"") 的写法也太怪异了
    .replace(/^\s+|\s+$/g,"")
      

  4.   

    这个错是由于使用了一些cms系统,后台建立数据字段,由于没有特别设置,默认text,so……
      

  5.   

    你的:YouYaX开源论坛
    咦,csdn改版了?突然觉得csdn的引用效果有点在模仿我的设计,
    以前不是这样的。
      

  6.   

    不可能犯这样的错误。price怎么可能是文本?