Javascript implements code instances similar to asp data dictionary data types, js Data Types

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.