Ajax framework-Dojo (1)

Source: Internet
Author: User

1. Do object functions

1) Dojo. byid (ID) 

<Input type = "text" id = "txtid" size = "30">
<Button type = "button" onclick = "alert (Dojo. byid ('txtid'). Value)"> test </button>

Note: This function does not return HTML elements based on the name attribute even in IE.

<Input type = "button" value = "testdiv" onclick = "dojo. byid ('A'). innerhtml = 'test'">
<Div id = "XX" name = "AA"> element 1 </div>
<Div id = "AA"> element 2 </div>

2) Dojo. addonload (functionname) and dojo. addonunload (functionname)

<SCRIPT type = "text/JavaScript">...
Dojo. addonload ( Function ()... {
Alert ("START"
);
}
);
</SCRIPT>

Note: The parameter of the addonload method is a reference to a function. You cannot use dojo. addonload (myonload ()). In addition, the function name cannot be onload.

3) Dojo. Require (packagename)Call package Space

Ii. String-related functions

1) Dojo. String. capitalize (string Str)Uppercase letters

2) Dojo. String. encodeascii (string Str)Convert a string to an ASCII string

3) dojo. String. endswith (string STR, string end, Boolean ignorecase) andDojo. String. startwith (string STR, string end, Boolean ignorecase)Check whether the string starts or ends with a specified string. The third parameter indicates whether the string is case sensitive.

4) dojo. String. endswithany (string,... str) andDojo. String. startwithany (string,... str)Check whether the string starts or ends with any one of the strings.

5) dojo. String. Has (string STR, substr1, substr2... substrn ))Returns true if any one is included.

6) Dojo. String. isblank (string Str)Judge whether the STR string is null

7) Dojo. String. Pad (string STR, integer Len, string C, integer DIR)Add a C string to the left or right of STR (C is 0 by default). The length of the string returned after addition is Len. If DIR is 1, add it to the left and-1 to the right. The default value is 1.

Note: simple form:Dojo. String. padleft (string STR, integer Len, string C) andDojo. String. padright (string STR, integer Len, string C)

8) dojo. String. Repeat (string STR, integer count, string separator)Generate STR string that has been repeated count times. The separator is separator.

9) dojo. String. Trim (string STR, integer Wh)Remove spaces. Wh is greater than 0 to the left, less than 0 to the right, left and right are not specified

Note: simple form:Dojo. String. trimstart (string Str) and dojo. String. trimend (string Str)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.