如何使用标记进行点击事件 [英] How to make click event with a tag
本文介绍了如何使用标记进行点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用带有click事件的标签和href链接我需要在代码中写入
当点击链接时它将通过在目标中编写iframe id在iframe上打开标签
我试过下面的代码
请帮助
我尝试了什么:
< ul > < li > < a id = urlbb runat = server > web1 < / li > < / ul >
< asp:PlaceHolder ID = url runat = server 可见 = false >
< iframe 名称 = aa width = 100% height = 800px style = margin-top:50px > < / iframe >
< asp:PlaceHolder ID = mainbody runat = server 可见 = true >
代码落后
受保护 void urlbb_ServerClick( object sender,EventArgs e)
{
mainbody。 Visible = false ;
url.Visible = true ;
urlbb.Target = aa;
urlbb.HRef = http://www.bradford.ac.uk/it-services/students /电子邮件/跨度>;
}
解决方案
使用链接按钮 [ ^ ]
< asp:LinkButton ID = urlbb runat = server OnClick = urlbb_Click > Web 1 < / asp:LinkButton >
I need to use a tag with click event and the href link I need to write it in code behind
when the link is clicked it will be opened on iframe by writing iframe id in the target of a tag
I tried the code below
please help
What I have tried:
<ul><li><a id="urlbb" runat="server" >web1</li></ul>
<asp:PlaceHolder ID="url" runat="server" Visible="false">
<iframe name="aa" width="100%" height="800px" style="margin-top:50px"></iframe>
<asp:PlaceHolder ID="mainbody" runat="server" Visible="true">
Code behind
protected void urlbb_ServerClick(object sender, EventArgs e)
{
mainbody.Visible = false;
url.Visible = true;
urlbb.Target = "aa";
urlbb.HRef = "http://www.bradford.ac.uk/it-services/students/email/";
}
解决方案
use Link Button [^]
<asp:LinkButton ID="urlbb" runat="server" OnClick="urlbb_Click">Web 1</asp:LinkButton>
这篇关于如何使用标记进行点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文