WebForm Repeater:重複器

來源:互聯網
上載者:User

標籤:

上午沒有學習新的內容,做註冊介面,用js寫驗證

<script type="text/javascript">
window.onload = function () {
document.getElementById("Button1").onclick = function () {
//使用者名稱驗證開始
var unameOK = true;
var oUname = document.getElementById("UserName_TextBox").value;
if (oUname == "") {
document.getElementById("UserError_Label").innerHTML = "使用者名稱不可為空";
unameOK = false;
}
else {
document.getElementById("UserError_Label").innerHTML = "";
unameOK = true;
}
//使用者名稱驗證結束

//密碼驗證開始,密碼兩次是否一致
var pwdOK = true;
var oPwd1 = document.getElementById("Pwd1_TextBox").value;
var oPwd2 = document.getElementById("Pwd2_TextBox").value;
if (oPwd1 != oPwd2) {
document.getElementById("PwdError_Label").innerHTML = "兩次密碼不一致!";
pwdOK = false;
}
else {
document.getElementById("PwdError_Label").innerHTML = "";
pwdOK = true;
}

//密碼驗證結束


if (unameOK == false || pwdOK == false) {
return false;
}
};
};
</script>

 

下午 學習的Repeater:重複器,主要有 五大模板

1.HeaderTemplate - 頭模板  裡面內容在開始顯示一遍

2.ItemTemplate - 項目範本  有多少條資料顯示多少條

3.FooterTemplate -腳模板  裡面內容在結束顯示一遍

4.AlternatingItemTemplate - 交替項目範本 與ItemTemplate一起用

-----------------------------------------------

資料繫結

list<Users> li =new usersData().Select();

Repeater1.DataSource=li;
Repeater1.DataBind();

資料內容顯示

頁面資料顯示位置:<%#Eval("屬性名稱") %>

1、顯示最終資料

欄位擴充

2、標記顏色顯示

封裝欄位

public string red

{

get{

   if(age>16)

   {return "

   }

   else{return "";}

}

}

style=“<%#Eval("red") %>”

3:
光棒效果,並且保留原有顏色。

滑鼠移出時 賦 滑鼠移入前的顏色!

<script type="text/javascript">
var oItems = document.getElementsByClassName("tr_item");
for (var i = 0; i < oItems.length; i++)
{
var oldColor = "";
oItems[i].onmouseover = function ()

{
oldColor = this.style.backgroundColor;
this.style.backgroundColor = "yellow";
};

oItems[i].onmouseout = function ()

{
this.style.backgroundColor = oldColor;

};
}

 

WebForm Repeater:重複器

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.