An AJAX framework of the Dojo chapter (i)

Source: Internet
Author: User
Tags button type integer

The function of a Do object

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 property, even in IE.

<input type="button" value="TestDiv" onClick="dojo.byId('aa').innerHTML='Test'">
<div id="xx" name="aa">Element 1</div>
<div id="aa">Element 2</div>
2) dojo.addOnLoad(functionName)和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 and cannot use Dojo.addonload (Myonload ()). In addition, this function name cannot be onload.

3) Dojo.require (PackageName) Call packet space

Two. String-related functions

1) dojo.string.capitalize (string str) First Letter Capital

2) Dojo.string.encodeAscii (String str) string converted to ASCII format string

3) Dojo.string.endsWith (string str,string end,boolean ignoreCase) and Dojo.string.startWith (string str,string end, Boolean ignoreCase) to see whether the string starts or ends with the specified string, and the third argument refers to whether the case is considered

4 Dojo.string.endsWithAny (string, ... str) and Dojo.string.startWithAny (string, ... str) see if the string starts or ends with any of the strings

5) Dojo.string.has (string str,substr1,substr2 ... substrn)) contains any one that returns true

6) Dojo.string.isBlank (string str) to determine if the STR string is empty

7) Dojo.string.pad (string Str,integer len,string c,integer dir) adds a C string to the left or right of STR (c defaults to 0), and the string returned after the addition is len,dir to 1 o'clock add to the left,- 1 o'clock on the right. The default is 1.

Note: abbreviated form: Dojo.string.padLeft (String Str,integer len,string C) and Dojo.string.padRight (string Str,integer len,string c)

8) dojo.string.repeat (string Str,integer count,string separator) generates a string that str repeats on count times, separator as a separator

9) Dojo.string.trim (string Str,integer wh) to space. WH is greater than 0 to the left, less than 0 to the right, not to the left

Note: abbreviated form: Dojo.string.trimStart (String str) and dojo.string.trimEnd (String str)

Related Article

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.