[英]Bold selected Text dynamically
I want Bold a part of my string dynamically . 我要动态地将字符串的一部分加粗。 when my user select part a text in ASP.Net and click Bold button than his text going to Bold . 当我的用户在ASP.Net中选择零件文本并单击粗体按钮时,他的文本将变为粗体。 what am i going to do ? 我该怎么办? Thanks in Advance . 提前致谢 。
Instead of id_123 in someFunc use the id of the DOM object that you want the onclick registered with. 代替someFunc中的id_123,使用要向其注册onclick的DOM对象的ID。
<html>
<body>
<p id="id_123" onClick="someFunc()">Here is some bolded text </p>
<script type="text/javascript">
function someFunc() {
var value = document.getElementById('id_123');
value.setAttribute('style', 'font-weight: bold;');
}
</script>
</body>
</html>
On button click add style to the text. 在按钮上单击添加样式到文本。
are you using javascript , or js libraries like jquery. 您在使用javascript还是jQuery之类的js库。
style=" font-weight:bold"
http://www.eggheadcafe.com/community/aspnet/17/10144717/css-style-change-when-im-clicking-link-button.aspx http://www.eggheadcafe.com/community/aspnet/17/10144717/css-style-change-when-im-clicking-link-button.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.