A界面代碼:
<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>無標(biāo)題頁(yè)</title>
</head>
<script type="text/javascript">
function limit(cbl) {
var cbs = document.getElementByIdx("<%= CheckBoxList1.ClientID %>").getElementsByTagName_r("input");
var count = 0;
for (var i = 0; i < cbs.length; i++) {
if (cbs[i].type == "checkbox") {
if (cbs[i].checked) {
count++;
}
}
}
if (count > 3) {
cbl.checked = false;
alert("不能多于3項(xiàng)");
return;
}
}
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" ForeColor="White" CellPadding="0"
CellSpacing="0" Height="70px">
<asp:ListItem Value="0"> Weekly email newsletter</asp:ListItem>
<asp:ListItem Value="1"> Sale and special offer updates</asp:ListItem>
<asp:ListItem Value="2"> Do not send me any more emails</asp:ListItem>
<asp:ListItem Value="3"> Do not send me any more emails</asp:ListItem>
<asp:ListItem Value="4"> Do not send me any more emails</asp:ListItem>
</asp:CheckBoxList>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
B界面代碼:
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (ListItem li in CheckBoxList1.Items)
li.Attributes.Add("onclick", "limit(this)");
}
protected void Button1_Click(object sender, EventArgs e)
{
string EmailSendType = null;
int n = this.CheckBoxList1.Items.Count;
for (int i = 0; i < n; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
if (EmailSendType != null)
EmailSendType += "," + CheckBoxList1.Items[i].Value;
else
EmailSendType = CheckBoxList1.Items[i].Value;
}
}
string[] str = EmailSendType.Split(",");//此處里面為單引號(hào)
foreach (string s in str)
{
if (s.Trim() != "")
{
if (s == "0")
{
Response.Write("aa0");
}
if (s == "1")
{
Response.Write("bb1");
}
if (s == "2")
{
Response.Write("cc2
?石家莊網(wǎng)站建設(shè)的優(yōu)點(diǎn):我們是專屬定制,制作符合您公司業(yè)務(wù)、風(fēng)格的網(wǎng)站,這就做到給您制作的網(wǎng)站是網(wǎng)絡(luò)上獨(dú)一無二的網(wǎng)站,這樣更有利于搜索引擎的收錄。如果您喜歡網(wǎng)絡(luò)上某個(gè)風(fēng)格的網(wǎng)站或者網(wǎng)站模板,我們是只仿制而不直接套用,我們會(huì)對(duì)其中的結(jié)構(gòu)和樣式做增減優(yōu)化,做…
?競(jìng)價(jià)排名營(yíng)銷是一種通過 競(jìng)價(jià)購(gòu)買搜索引擎中關(guān)鍵詞或關(guān)鍵短語(yǔ)的廣告方式。競(jìng)價(jià)排名營(yíng)銷分為兩種類型。 第一種,直接為真正的搜索引擎結(jié)果的排名付費(fèi),也就是說付的錢越多,網(wǎng)頁(yè)所獲得的排名名也就越高。 第二種則更類似于普通的廣告。這種競(jìng)價(jià)排名營(yíng)銷方式通過…
?網(wǎng)站優(yōu)化對(duì)網(wǎng)站來說是非常重要的,直接決定和影響著網(wǎng)站所起到的作用,以及在各個(gè)地方當(dāng)中的排名。在進(jìn)行seo優(yōu)化的過程中,我們必須要堅(jiān)持一定的原則,真正的把這些事情做得更好,才可以確保最終的結(jié)果,這對(duì)于我們來說是非常重要的事。 SEO優(yōu)化主要分為8小步: …