JavaScript Reference/Javascript Objects/String

Материал из Web эксперт
Перейти к: навигация, поиск

"String" Example

    
<html>
<body>
<div id="myDiv" style="width:100; height:100;">This is some sample text</div>
<script language="javascript">
function function1(){
    var temp = new String(); temp = myDiv.innerText; alert(temp); 
} 
</script>
<button onclick="function1();">String function</button>
</body>
</html>



"String" JavaScript Methods

+----------------+--------------------------------------------------------------+
| JavaScript     |anchor                          big                           |
| Methods        |blink                           bold                          |
|                |charAt                          charCodeAt                    |
|                |concat                          fixed                         |
|                |fontColor                       fontSize                      |
|                |fromCharCode                    indexOf                       |
|                |italics                         lastIndexOf                   |
|                |link                            localeCompare                 |
|                |match                           replace                       |
|                |search                          slice                         |
|                |small                           split                         |
|                |strike                          sub                           |
|                |substr                          substring                     |
|                |sup                             toLocaleLowerCase             |
|                |toLocaleUpperCase               toLowerCase                   |
|                |toSource                        toUpperCase                   |
|                |valueOf                                                       |
+----------------+--------------------------------------------------------------+



"String" JavaScript Properties

+----------------+--------------------------------------------------------------+
| JavaScript     |constructor                     length                        |
+----------------+--------------------------------------------------------------+



"String" Syntax and Note

Note:
Manipulate a string.
    
Syntax:
    
var stringName = new String("value") // value is any string
stringName.memberName