我的页面中有一个链接,我想更改用户将鼠标悬停在链接上时显示的文字:
<a id="mylink" runat="server" onmouseover="javascript:ShowAssignments();" onmouseout="javascript:HideAssignments();" title="Click here to assign"></a>
ClientScript.RegisterClientScriptBlock(this.GetType(), "doShowAssignments", "<script type='text/javascript'>function ShowAssignments() { try { if (document.all) { document.all('" + lbnShowTemplateInfo.ClientID + "').click(); } else { document.getElementById('" + lbnShowTemplateInfo.ClientID + "').click(); } } catch(e){} } </script>");
protected void lbnShowTemplateInfo_Click(object sender, EventArgs e)
{
// get list of assignments formatted as string from a datatable
string templateAssignment = GetAssignment(dtTemplateAssignments, "Template");
if (!String.IsNullOrEmpty(templateAssignment))
{
templateAssignment = "Assigned to: " + templateAssignment;
lnkCurrentAssignments.InnerHtml = templateAssignment;
}
else
{
lnkCurrentAssignments.InnerHtml = "Assign";
}
}
ShowAssignments方法会触发一些C#代码,但我的问题是没有显示工具提示,而且当鼠标悬停在此链接上时,似乎我的页面正在连续加载。
我该怎样防止这种情况?提前致谢! :)