|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Javascrript help
Could someone please tell me how to obtain the Value of the file/browse box on an HTML form using Javascript. (or any form field for that matter.)
Any help appreciated. Whilst my PHP is ok my Javasript is sadly lacking so keep it simple. Cheers |
|
#2
|
|||
|
|||
|
RE: Javascrript help
all you need to do is reference the value of the form field like so.
document.formname.fieldname.value and assign it to a variable. The following example will show a popup alert of the field value of the input file type when you click the submit button. <form method="post" name="form1"> <input type="file" enctype="multipart/form-data" name="file" /> <input type="submit" name="submit" value="Submit" onclick="alert(document.form1.file.value);return false;"/> </form> note the return false is there to actually prevent the form from being submitted for this example. If you put this code in a page and then browse for a file, then click the submit button, the popup will show the file selected. This method can be used for any form field. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Javascrript help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|