这是我从头开始制作的addentry博客页面,这个代码存在潜在的问题,特别是清除按钮,它应该清除按下单击按钮时输入的任何文本我没有工作将其保存为html文件就是问题所在。
另外一个问题是它工作的提交按钮但是它没有将任何文本传递给我将其写为php的索引文件,并且出于某种原因,每当我点击提交按钮时它只是重定向我回到索引页面而没有发布我所做的条目。
<!DOCTYPE html>
<html>
<head>
<script>
function message() {
alert("Clear the form?");
}
</script>
<style>
body {background-color: beige;}
h1 {color: black;}
p {color: black;}
textarea
{
width: 50%;
height: 150px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: white;
font-size: 16px;
resize: none;
}
div
{
padding-left: 20px;
}
</style>
</head>
<meta charset="utf-8">
<link rel="stylesheet" href="../../main.css">
<title>Add an entry</title>
</head>
<body>
<div><h1>Add an entry</h1></div>
<div><p><b>Enter the title of the entry so the topic is clearly defined and then add the entry for the blog that you want to write about after finishing writing about your topic press the submit button to submit the entry which will be posted in the main page of the blog however if you wish to discard or clear your entry then press the clear button to remove your topic which you have written about.</b></p></div>
<form onreset="message()">
<p><label>Title</label>
<input type = "text" id = "myText"/></p>
<p><label>Entry</label>
<textarea>
<input type="clear">
</form>
<form>
<p><label>Title</label>
<input type = "text" id = "myText"/></p>
<p><label>Entry</label>
<textarea>
</textarea></p>
</form>
<form method="post" action="index.html">
<button type="submit" value="Submit">Submit</button> <input type="button" value="Clear" onclick="javascript:eraseText();">
</form>
</body>
</html>
特别是这部分清除按钮代码:
<script>
function message() {
alert("Clear the form?");
}
</script>
<form onreset="message()">
<p><label>Title</label>
<input type = "text" id = "myText"/></p>
<p><label>Entry</label>
<textarea>
<input type="clear">
</form>
这是提交按钮代码:
<form method="post" action="index.html">
<button type="submit" value="Submit">Submit</button>
<input type="button" value="Clear" onclick="javascript:eraseText();">
</form>
答案 0 :(得分:0)
1)只需使用带$jrCrop.crop({
url: url,
width: 200,
height: 200
}).then(function(canvas) {
// success!
var image = canvas.toDataURL();
}, function() {
// User canceled or couldn't load image.
});
的输入字段,它就会清除表格
2)所有输入字段应该是相同的形式,然后才会发布到下一页
注意:您使用多个表单并期望索引页面上的其他表单值。
type="reset"
&#13;