例一:

<script type="text/javascript">

 var str="Hello world!" document.write(str.substring(3))

</script>

输出:

lo world!

例二:

<script type="text/javascript">

 var str="Hello world!" document.write(str.substring(3,7))

 </script>

输出:

lo w