有没有办法在ASP.Net中将Input type = text转换为Span
答案 0 :(得分:2)
您真的应该提供有关您想要执行此操作的方案的更多信息,但这里有几个通用的方法。
if(ChangeTextToSpan) { //some condition to check, could be a query string or what ever
this.Label1.Text = this.TextBox1.Text;
this.Label1.Visible = !this.TextBox1.Visibile = false;
}
function swapTextBox(changeTextToSpan) {
if(changeTextToSpan) { //again, do a condition
var span = document.getElementById('<%= this.Label1.ClientID %>');
var txt = document.getElementById('<%= this.TextBox1.ClientID %>');
span.innerHTML = txt.value;
span.style.display = 'inline';
txt.style.display = 'none';
}
}
setTimeout(10000, swapTextBox(true)); //after 10 seconds it'll swap