日期:2014-05-16 浏览次数:20410 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(function () { $('#a').click(function () { alert($('input[name=filename]').val()); }) }) </script> </head> <body> <input type='file' name='filename' size='15'> <input id='a' value='upload' type='button' /> </body> </html>
------解决方案--------------------
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
</head>
<body>
<input type='file' name='filename' size='15' onchange="alert(this.value)">
</body>
</html>
------解决方案--------------------
判断文本框里面有值没。