Home  >  Article  >  Web Front-end  >  How to add quantity subscript to message button in html

How to add quantity subscript to message button in html

php中世界最好的语言
php中世界最好的语言Original
2018-01-18 09:18:213230browse

This time I will show you how to add a quantity subscript on the message button in HTML. What are the precautions for adding a quantity subscript on the message button in HTML? The following is a practical case, let's take a look.

bf552137c0a82bf6fc5db4a2666592c2Message< ;span id="msgNum" class="ii">454bdf357c58b8a65c66d7c19c8e4d1145db79b134e9f6b82c0b36e0489ee08ed

css code:

/*角标 */
    .ii{
        display: none;
        background: #f00;
        border-radius: 50%;
        width: 20px;
        height: 20px;
        top: 5px;
        right: 0px;
        position: absolute;
        text-align: center;
        color: #FFF;
        z-index: 99999;
    }

js code:

function ajaxa(){
         $.ajax({
                type:"POST",
                dataType : "json",
                async: false,
                url : "${pageContext.request.contextPath}/docinf/sendInform/lookForMsgNum.do",
                data : {},
                success : function(data){
                    if(data !=null){
                        if(parseInt(data)>10){
                            $("#msgNum").show();
                            $("#msgNum").text(parseInt(data));
                        }else if(parseInt(data)> 0){
                            $("#msgNum").show();
                            $("#msgNum").text(parseInt(data));
                        }else{
                            $("#msgNum").hide();
                        }
                    }
                },
                error:function(){
                }
            });
    }

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to use the img tag of HTML images

Detailed explanation of the meta column in the WEB interface of HTML5

How to use html form submission in HTML

The above is the detailed content of How to add quantity subscript to message button in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn