我一直在制作带有母版页的网页表单,我遇到了错误:只允许内容控件直接放在包含内容控件的内容页面中。现在我已经调查了不同的论坛,我无法找到解决方案。这从来没有出现在我面前,而且很奇怪,因为我每次做的都是一样的 这是代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script>
function CheckAll()
{
var flag = true;
var length = document.getElementById('user').value.length;
var value = document.getElementById('user').value;
for (var i = 0; i < length; i++) {
if (!((value.charAt(i) >= '0' && value.charAt(i) <= '9') || (value.charAt(i) >= 'a' && value.charAt(i) <= 'z') || (value.charAt(i) >= 'A' && value.charAt(i) <= 'Z'))) {
alert("username must be made of characters and numbers only");
return false;
}
}
var lengthPass = document.getElementById('password').value.length;
var valuePass = document.getElementById('password').value;
for (var i = 0; i < lengthPass; i++) {
if (!((valuePass.charAt(i) >= '0' && valuePass.charAt(i) <= '9') || (valuePass.charAt(i) >= 'a' && valuePass.charAt(i) <= 'z') || (valuePass.charAt(i) >= 'A' && valuePass.charAt(i) <= 'Z'))) {
alert("Password must be made of characters and numbers only");
return false;
}
}
if (!(length >= 6 || length <= 20))
{
alert("Username Must be 6-20 Characters long");
return false;
}
if (!(lengthPass >= 6 || lengthPass <= 20))
{
alert("Password must be 6-20 characters long")
return false;
}
var x = document.forms["form"]["mail"].value;
var atpos = x.indexOf("@");
var dotpos = x.lastIndexOf(".");
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
alert("Not a valid e-mail address");
return false;
}
var valuePhone = document.getElementById('phone').value;
var lengthPhone = document.getElementById('phone').value.length;
for (var i = 0; i < length; i++)
{
if (!((valuePhone.charAt(i) >= '0' || valuePhone.charAt(i) <= '9')))
{
alert("phone number must be made of numbers only");
return false;
}
}
if (lengthPhone != 10)
{
alert("phone number must be 10 numbers long");
}
return true;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<form id="form" runat="server">
Name+Last Name: <input type="text" name="names" id="name" />
<br />
<br /> Username: <input type="text" name="username" id="user" />
<br />
<p style="font-size:70%">must contain 6-20 character</p>
<br /> Password: <input type="text" name="password" id="password" />
<br />
<p style="font-size:70%">must contain 6-20</p>
<br /> E-mail: <input type="text" name="mail" id="mail" />
<br /> Phone Number: <input type="text" name="phone" id="phone" />
<br /> Enter Your Birth Date:
<br />
<input type="date" name="date" id="date"/>
<br />
<br /> Enter Your Favourite Esports Game:
<select name="choose" id="choose">
<option>League Of Legends</option>
<option>Dota</option>
<option>StarCraft</option>
<option>Street Fighter</option>
<option>Smite</option>
<option>Mortal Kombat</option>
<option>Heroes Of The Storm</option>
<option>Super Smash Bros</option>
<option>Call of Duty</option>
<option>Counter Strike: Global Offensive</option>
<option>I Dont Watch Esports</option>
</select>
<table border="1">
<tr>
<th>
<a href="HomePage.html" style="color:red">To Get Back To The Home Page</a>
</th>
</tr>
</table>
<br />
<br />
<input type="checkbox" name="agree" id="agree" value="check validity" onclick="AgreeCheck()" />
<input type="submit" name="sub" id="sub" value="submit" disabled />
</form>
<script>
function AgreeCheck() {
document.getElementById("agree").checked = CheckAll();
document.getElementById("sub").disabled = !CheckAll();
}
</script>
</asp:Content>