Who else will make these two mistakes ???? First JS issue
《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》
Do you think this is correct? Run the program to see if it is correct ..
The second database problem.
Data table name product
Id int (4)
Name varchar (20 );
Price text
There are 2 records
Id name price
1 TV 750.00
2. air conditioner 5000
Sort by price
Write SQL statements
Select * from product order by price desc
If you think it is correct, run the following command,
Reply to discussion (solution)
I have been paying close attention to the landlord.
First, I will not store the price field in text, so this error will not occur.
I have been paying close attention to the landlord. Follow me
First JS issue
《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》
Do you think this is correct? Run the program to see if it is correct ..
The second database problem.
Data table name product
Id int (4)
Name varchar (20 );
Price text
There are 2 records
Id name price
1 TV 750.00
2. air conditioner 5000
Sort by price
Write SQL statements
Select * from product order by price desc
If you think it is correct, run the following command,
First, it is clear that the price must be replaced by regular expressions, and the habit of making a price comparison is to convert it into a digital comparison.
I don't think "who will make these two mistakes", but "who will write this code ".
The first one is entered in the text box,
For example, I can enter 5000 with so many spaces.
The second price is fixed.
First JS issue
《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》
Do you think this is correct? Run the program to see if it is correct ..
The second database problem.
Data table name product
Id int (4)
Name varchar (20 );
Price text
There are 2 records
Id name price
1 TV 750.00
2. air conditioner 5000
Sort by price
Write SQL statements
Select * from product order by price desc
If you think it is correct, run the following command,
First, it is clear that the price must be replaced by regular expressions, and the habit of making a price comparison is to convert it into a digital comparison.
I don't think "who will make these two mistakes", but "who will write this code ".
If ($ ("bid "). value. replace (/^ \ s + /,""). replace (/\ s + $/, "") <$ ("reserve_price "). value)
Should be
If (parseFloat ($ ("bid"). value)
Select * from product order by price desc
Should be
Select * from product order by price + 0 desc
Or change the price to the DECIMAL type.
Again, replace (/^ \ s +/, ""). replace (/\ s + $/, "") is too weird.
. Replace (/^ \ s + | \ s + $/g ,"")
Again, replace (/^ \ s +/, ""). replace (/\ s + $/, "") is too weird.
. Replace (/^ \ s + | \ s + $/g ,"")
I used to search for regular expressions on the Internet.
First, I will not store the price field in text, so this error will not occur.
This error is caused by the use of some cms systems and the creation of data fields in the background. the default value is text, so ......
I have been paying close attention to the landlord. Follow me
Your: YouYaX Open Source Forum
I have been paying close attention to the landlord. Follow me
Your: YouYaX Open Source Forum
Why is csdn revised? I suddenly felt that the reference effect of csdn was a little imitating my design,
This was not the case before.
Haha,
It is impossible to make such a mistake. How can price be text?