You could use the split function to return the last part of the string:
PHP Code:
<html>
<head>
<script type="text/javascript">
function parts()
{
var path = document.forms[0].path.value;
var parts = path.split("\\");
var i = parts.length - 1;
alert(parts[i]);
}
</script>
</head>
<body>
<form action="" method="">
<input type="text" name="path"><br>
<input type="button" name="but" value="Split" onclick="parts();">
</form>
</body>
</html>
Good luck;