pe******@gmail.com wrote:
cant get it to work. can someone help me pls.
Below is a small test. You'll note that using a file input requires
that an actual file is selected, users may have difficulty entering a
valid directory path.
Anyhow, if it's all too much, change the input type to 'text' and let
them copy/paste from Windows Explorer or a terminal window or whatever.
<title>Check path</title>
<script type="text/javascript">
function checkPath(form){
var path = form.divPath.value;
if (! /[\\/:]$/.test(path) ){
return confirm('The path you have entered is:\n' + path
+ '\nThis doesn\'t seem correct, it should end in'
+ ' "\\" or "/".'
+ '\nClick OK to send the path or Cancel to return'
+ ' to the form.');
}
}
</script>
<form action="" onsubmit="return checkPath(this);">
<p>Enter a directory path:<br>
<input type="file" name="divPath" size="100"><br>
<input type="submit" value="Submit path">
</p>
</form>
--
Rob