I have a form that includes a file input and a text input. I'd like the text input to fill with the filename (sans path and extension) by default when the file input loses focus. What methods should I look into to learn to do this?
01-18-2006, 07:15 PM
as a clarification, is it possible to run a function as soon as the file dialog has closed, rather than onblur?
var filename = document.getElementById("file").value;
var namearray = filename.split('\\');
var basename = namearray[namearray.length - 1];
var namearray = basename.split('.');
var title = namearray;
document.getElementById('title').value = title;