Home  >  Article  >  Web Front-end  >  Share a piece of HTML implementation code for adding a quantity subscript on a message button

Share a piece of HTML implementation code for adding a quantity subscript on a message button

怪我咯
怪我咯Original
2017-05-29 09:46:091946browse

This article mainly introduces the implementation code of adding quantity subscripts on the message button in HTML. Friends who need it can refer to the

html code:

消息4

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(){
                }
            });
    }

Achievement effect:

Share a piece of HTML implementation code for adding a quantity subscript on a message button

The above is the detailed content of Share a piece of HTML implementation code for adding a quantity subscript on a message button. 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