var val='http://localhost/site/someimage.jpg' alert(val.substring(val.lastIndexOf('/')+1,val.length))