Javascript implements code instances similar to asp data dictionary data types, js Data Types
First declare an array:
Copy codeThe Code is as follows:
Var dictNew = new Array;
Var key;
Var value;
For (var I = 0; I <50; I ++ ){
// Obtain the key-value pair to be added to the data dictionary
Key = jQuery ("# costCodeIdId" + I). val ();
Value = num2zero (jQuery ("# valueId" + I). val ());
// Check whether the key value exists in the data dictionary. If not, add the key value and value to the data dictionary. If the key value exists, the value is accumulated.
If (checkHasInDict (key, dictNew )){
DictNew [key] = num2zero (dictNew [key]) + value;
} Else {
DictNew [key] = value;
}
}
// Value of the data dictionary
Function getDictValue (key, dict ){
Var tempDictValue = "";
For (var k in dict ){
If (k = key ){
TempDictValue = dict [k];
Return tempDictValue;
}
}
Return tempDictValue;
}
// Check whether the key value exists in the array
Function checkHasInDict (key, dict ){
For (var k in dict ){
If (k = key ){
Return true;
}
}
Return false;
}
How can I call js Code after judging data values in asp?
You can use a separate file for the subsequent JavaScript code, such as a. asp, to save it.
Then use the following code.
The asp code is as follows:
<%
If rs_body ("Flag") = "No" then
'How can I write it here?
End if
%> // This is your program
The asp code is as follows:
<%
If rs_body ("Flag") = "No" then
%>
<! -- # Include file = "a. asp" -->
<%
End if
%>
In this way, your problem is solved. If you do not understand it, leave a message to me.
In aspnet, the background code and js can both be implemented. Is it implemented using js or the underlying cs?
Saving system resources with JS and avoiding repeated submission
He cannot modify JS, but the data sent from the client to the server is not reliable. That is to say, even if you have standardized the data sent from the client on the client, the data may not comply with the specifications.