我使用此代碼從代碼隱藏調用JS函數。Codebehind調用JS函數
這是按鈕點擊事件。
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myfunction", "testFunc();", true);
這是JS的代碼。
function testFunc() {
//alert("msg");
document.getElementById("Text1").value = "value change";
//Text1 is html a text box
}
它不改變文本框的值。但是,如果我添加警報,它會顯示警報,我們可以確定JS功能正在成功執行。
可能是我的代碼問題?
能不能請您發表您的HTML/ASP碼? –
出於測試目的嘗試JS警報()函數,因爲一些HTML控制是代替值usinh的innerHTML – user3455363