2009-02-11 10 views

Répondre

2

Vous devriez vraiment fournir plus d'informations sur le scénario que vous voulez faire cela pour, mais voici quelques uns génériques.

Le faire côté serveur

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; 
} 

Le faire côté client

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 
Questions connexes