HTML 4_Memunculkan bagian string tertentu

<html>
<body>
<script type="text/javascript">
var str="W3CSchools is great!"
document.write(str.substr(2,6))
document.write("<br /><br />")document.write(str.substring(2,6))
</script>
<p>
The substr() method returns a specified part of a string. If you specify (2,6)
the returned string will be from the second character (start at 0) and 6 long.
</p>
<p>
The substring() method also returns a specified part of a string. If you specify
(2,6) it returns all characters from the second character (start at 0) and up
to, but not including, the sixth character.
</p>
</body>
</html>
Category: 0 komentar

0 komentar:

Posting Komentar