Well, when you put it that way "a text box somewhere else on the page", I cannot be sure said text box will be part of the same form or part of any form. So, this is a good way to do that, under the circumstances:
Code:
function extract(what)
{
if (what.indexOf('/') > -1)
answer = what.substring(what.lastIndexOf('/')+1,what.length);
else
answer = what.substring(what.lastIndexOf('\\')+1,what.length);
document.getElementById('fname_txtbx').value=answer;
}
HTML Code:
<input type="text" id="fname_txtbx">
Notes: This will work even if the text box is a part of a form. If it is a part of a form, say the 1st element in a form named 'form12', you can access its value like so:
Code:
document.forms['form12'][0].value
Bookmarks