把TextBox文本框綁定成時間樣式的文本框

<textarea cols="50" rows="15" name="code" class="c-sharp">private void DisPlayTime() { txtbegin.Attributes.Add("style", "color:#999;");//.Style.Value = "textbox"; txtbegin.Attributes.Add("value", "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ""); txtbegin.Attributes.Add("onfocus", "if(this.value=='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'){this.value='';this.style.color='#000';}"); txtbegin.Attributes.Add("onblur", "if(this.value==''){this.value='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "';this.style.color='#999';}"); txtend.Attributes.Add("style", "color:#999;");//.Style.Value = "textbox"; txtend.Attributes.Add("value", "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ""); txtend.Attributes.Add("onfocus", "if(this.value=='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'){this.value='';this.style.color='#000';}"); txtend.Attributes.Add("onblur", "if(this.value==''){this.value='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "';this.style.color='#999';}"); }</textarea>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章