JavaScript - Using Substring()Method

Asked By sai on 25-May-11 08:00 AM
  hi,

   can we attached a file , using substring() method and  HTML controls ..can u give brief example

Thanks
Reena Jain replied to sai on 25-May-11 08:10 AM
hi,

The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string.

This method extracts the characters in a string between "from" and "to", not including "to" itself.


//Example of extract characters from a string:
<script type="text/javascript">
 
var str="Reena Jain!";
document.write(str.substring(5)+"<br />");
document.write(str.substring(5,4));
 
</script>

Hope this will help you
TSN ... replied to sai on 25-May-11 02:42 PM
hi..


you cannot do this i think so..

because the substring method is intended to give the substring of the given text between the values providede..

hope this helps you...