开发者

Bold selected Text dynamically

开发者 https://www.devze.com 2023-01-26 07:52 出处:网络
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 .

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 . 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.

<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.

style=" font-weight:bold" 

http://www.eggheadcafe.com/community/aspnet/17/10144717/css-style-change-when-im-clicking-link-button.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号