有什么不妥以下HTMLA和JavaScript代码Javascript来写转换为大写
formToConvert.html
<html>
<head>
<title>ExampleToConvert</title>
<script type = "text/javascript" src = "con.js"></script>
</head>
<body>
<form id ="myform">
<input type = "text" id = "field1" value = "Enter text Here"/><br/>
<input type ="submit" value = "submit" onclick = "convert()"/>
</form>
</body>
</html>
con.js
function convert()
{
var str ;
str = document.getElementById("field1");
document.writeln(str.toUpperCase());
}
为什么上面的代码没有给我想要的结果?
什么结果它给你? – rlemon
人们获得声誉downvote无辜的问题,为什么哥们? – SMI
@SMI:我没有投下这个问题,但是这个人可能是这样做的,因为OP没有指定预期结果和实际结果之间的差异。换句话说,他们没有确定不需要的症状。 –