日期:2014-05-16  浏览次数:20296 次

如何获取表单中的P元素?
<input>元素外面套了一个<p>元素,如果用javascript获取这个p元素?

------解决方案--------------------
<html>
<head>
<title>Upload File</title>
</head>
<body>
<form name="myForm" action="#" method="post">
<label for="uploading_file"><strong>File Uploading:</strong></label>
<p><input type="file" name="uploading_file" id="uploading_file"></p>
<input type="button" value="-" onclick="decreasing_quantity()">
<input type="text" name="quantity" maxlength="2" size="2" value="0""/>
<input type="button" value="+" onclick="increasing_quantity()">
<input type="submit" value="Submit Files">
</form>
<script>
alert( document.getElementById('uploading_file').parentNode )
</script>
</body>
</html>