Home > Article > Web Front-end > Detailed explanation of the example of implementing the quantity subscript on the message button in HTML
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:
<a onclick="goMessage();" style="width: 60px;height: 100%;color: white;background: transparent;" href="#" class="easyui-linkbutton" data-options="iconCls:'fa fa-bell-o fa-2x',size:'large',iconAlign:'top'"> 消息<span id="msgNum" class="ii">4</span> </a>
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:
##[Related recommendations]1. 2.
Html Jquery code example to complete asynchronous file upload
3.Yes Graphical explanation of HTTP Headers knowledge points
4.Detailed explanation of Html5 datalist tags and dynamic matching with background data
5.Share a super Comprehensive summary of HTML and CSS knowledge points
The above is the detailed content of Detailed explanation of the example of implementing the quantity subscript on the message button in HTML. For more information, please follow other related articles on the PHP Chinese website!