0

我的页面中有一个链接,我想更改用户将鼠标悬停在链接上时显示的文本:

<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# 代码,但我的问题是没有显示工具提示,并且当鼠标悬停在此链接上时,我的页面似乎在持续加载。

我怎样才能防止这种情况?提前致谢!:)

4

0 回答 0