http://api.jquery.com/attr/
<p>
Once there was a <em title="huge, gigantic">large</em> dinosaur...</p>
The title of the emphasis is:<div></div>
<script>
var title = $("em").attr("title");
<p>
Once there was a <em title="huge, gigantic">large</em> dinosaur...</p>
The title of the emphasis is:<div></div>
<script>
var title = $("em").attr("title");
document.write (a + 3*3 + b);
a, then the result of 3*3, treated as a string for the occasion, and then b, which givesHello world!9I am a JavaScript hacker.
document.write (a + 3+3 + b);
a, 3, 3 and b, because + in this context meansconcatenate strings, not add, and givesHello world!33I am a JavaScript hacker.
document.write (a + (3+3) + b);
a, the result of 3+3 and b and givesHello world!6I am a JavaScript hacker.
indexOf. Each character has an index number, giving its position in the string. Note that the first character has index 0, the second one index 1 etc. So the index of 'w' in string a is 6.indexOf we can read out the index number of a character. Put the.indexOf('') behind the string name and put the character you're looking for between the quotes. Thisvar a = 'Hello world!';
document.write(a.indexOf('w'))
6. If the same character occurs more than once, this method gives the first occurrence. Sovar len=arr.length;
for(var i=0; i<len; i++) {
var value = arr[i];
alert(i =") "+value);
}