如何在警报框中获取文件类型控件的值? [英] How to get value of file type control on alert box?
本文介绍了如何在警报框中获取文件类型控件的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hii,
我正在使用这个脚本..当我将文件控件更改为其他内容并添加任何文件时,我想在我的警告框中输入路径名和文件
Hii,
I am using this script .. i want path name and file on my alert box when i change my file control to somthing else and add any file
$(document).ready(function () {
debugger;
$('#file').change(function () {
var value = $(this).attr('value');
alert(value);
});
});
i我正在使用这个
但它在警报框中给我未定义的价值
i am using this
but its giving me undefined value on alert box
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnableSubmit_29.aspx.cs" Inherits="ContainSelector.EnableSubmit_29" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Enable Submit</title>
</head>
<script src="Js/ProductionFile.js" type="text/javascript"></script>
<script src="Js/EnableSubmit.js" type="text/javascript"></script>
<body>
<form action="#" method="post" enctype="multipart/form-data">
<input id="file" type="file" />
<input id="btnUpload" type="submit" value="Upload" disabled="disabled" />
</form>
</body>
</html>
推荐答案
(document).ready(function(){
debugger;
(document).ready(function () { debugger;
(' #file')。change(function(){
var value =
('#file').change(function () { var value =
( t他的)。attr(' value');
alert( value );
});
});
(this).attr('value'); alert(value); }); });
i我正在使用此
但它在警报框中给我未定义的值
i am using this
but its giving me undefined value on alert box
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnableSubmit_29.aspx.cs" Inherits="ContainSelector.EnableSubmit_29" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Enable Submit</title>
</head>
<script src="Js/ProductionFile.js" type="text/javascript"></script>
<script src="Js/EnableSubmit.js" type="text/javascript"></script>
<body>
<form action="#" method="post" enctype="multipart/form-data">
<input id="file" type="file" />
<input id="btnUpload" type="submit" value="Upload" disabled="disabled" />
</form>
</body>
</html>
这篇关于如何在警报框中获取文件类型控件的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文