Imagebutton вызов функции javascript onmouseover
I have some ImageButton, every time the mouse passes over ImageButton I would like to change the content of TextBox
every time OnMouseOver occurs on ImageButton must call the init() function, this happens only 1 time (Page_Load) , after loaded the page does not click anymore
is this this.ImageButton6.Attributes.Add("onmouseover", "javascript:init();");
that this ScriptManager.RegisterStartupScript(Page, this.GetType(), Guid.NewGuid().ToString(), "init();", true); work only one time (Page_Load)
Что я уже пробовал:
on .aspx файл
<script language="javascript"> function init() { <%ChangeMsg();%>; // chiama funzione C# } </script>
на .файл CS
protected void Page_Load(object sender, EventArgs e) { //this.ImageButton6.Attributes.Add("onmouseover", "javascript:init();"); ScriptManager.RegisterStartupScript(Page, this.GetType(), Guid.NewGuid().ToString(), "init();", true); var data = File.ReadAllText(Server.MapPath("~//TextFiles/develop.txt")); //read text file BoxStart.Visible = true; BoxStart.Text = data.ToString(); //assign text to TextBox }
функция c#, вызываемая JS
public void ChangeMsg() { var data = File.ReadAllText(Server.MapPath("~//TextFiles/Start.txt")); //read file BoxStart.Visible = true; BoxStart.Text = data.ToString(); //assign }
Gerry Schmitz
Это прискорбная трата драгоценной жизненной энергии.