一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專(zhuān)注于服務(wù)器技術(shù)及軟件下載分享
分類(lèi)導(dǎo)航

node.js|vue.js|Jquery|angularjs|React|json|js教程|

服務(wù)器之家 - 編程語(yǔ)言 - JavaScript - js教程 - Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

2021-12-15 15:37юноша 2 js教程

這篇文章主要為大家詳細(xì)介紹了Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

Jquery+javascript動(dòng)態(tài)生成支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

制作網(wǎng)頁(yè)支付界面的時(shí)候,數(shù)字鍵盤(pán)適配不同的屏幕寬高比是一個(gè)很麻煩的事,所以我制作了一個(gè)根據(jù)屏幕寬高動(dòng)態(tài)生成的數(shù)字鍵盤(pán)

運(yùn)行截圖:

Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

實(shí)現(xiàn)代碼

html:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <meta content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
 <meta content="yes" name="apple-mobile-web-app-capable">
 <meta content="black" name="apple-mobile-web-app-status-bar-style">
 <meta content="telephone=no" name="format-detection">
 <meta content="email=no" name="format-detection">
 <link rel="stylesheet" href="{{你的css文件路徑}}" >
 <title>動(dòng)態(tài)數(shù)字鍵盤(pán)</title>
</head>
<body>
 <div class="pay-top">
 <img class="lklogo" src="img/lianke.png">
 <div class="pay-shop-info">
 <span class="shop-name">付款給:{{付款對(duì)象名}}</span>
 </div>
 <div class="paymoneylogo">
 <span>¥</span>
 </div>
 <label class="inputlabel" id="paymoney" type="text"></label>
 </div>
 <div class="payinfo">
 <table cellspacing="0" cellpadding="0">
 <tr>
 <td class="paynum">1</td>
 <td class="paynum">2</td>
 <td class="paynum">3</td>
 <td id="pay-return">
  <div class="keybord-return"></div>
 </td>
 </tr>
 <tr>
 <td class="paynum">4</td>
 <td class="paynum">5</td>
 <td class="paynum">6</td>
 <td rowspan="3" class="pay">
  <a href="javascript:return false;" >
  <div class="a-pay">
  <p>確認(rèn)</p>
  <p>支付</p>
  </div>
  </a>
 </td>
 </tr>
 <tr>
 <td class="paynum">7</td>
 <td class="paynum">8</td>
 <td class="paynum">9</td>
 </tr>
 <tr>
 <td id="pay-zero" colspan="2" class="payzero">0</td>
 <td id="pay-float">.</td>
 </tr>
 </table>
 </div>
</body>
<script src="./js/jquery.js"></script>
<script type="text/javascript">
 $(function () {
 $(".payinfo").slideDown();
 var $paymoney = $("#paymoney");
 $("#paymoney").focus(function () {
 $(".payinfo").slideDown();
 document.activeElement.blur();
 });
 $(".paynum").each(function () {
 $(this).click(function () {
 if (($paymoney.text()).indexOf(".") != -1 && ($paymoney.text()).substring(($paymoney.text()).indexOf(".") + 1, ($paymoney.text()).length).length == 2) {
  return;
 }
 if ($.trim($paymoney.text()) == "0") {
  return;
 }
 if (parseInt($paymoney.text()) > 10000 && $paymoney.text().indexOf(".") == -1) {
  return;
 }
 $paymoney.text($paymoney.text() + $(this).text());
 });
 });
 
 $("#pay-return").click(function () {
 $paymoney.text(($paymoney.text()).substring(0, ($paymoney.text()).length - 1));
 if (!$paymoney.text()) {
 $('.pay').addClass('pay-disabled').find('a').attr('href', 'javascript:return false;');
 }
 });
 
 $("#pay-zero").click(function () {
 if (($paymoney.text()).indexOf(".") != -1 && ($paymoney.text()).substring(($paymoney.text()).indexOf(".") + 1, ($paymoney.text()).length).length == 2) {
 return;
 }
 if ($.trim($paymoney.text()) == "0") {
 return;
 }
 if (parseInt($paymoney.text()) > 10000 && $paymoney.text().indexOf(".") == -1) {
 return;
 }
 $paymoney.text($paymoney.text() + $(this).text());
 });
 
 $("#pay-float").click(function () {
 if ($.trim($paymoney.text()) == "") {
 return;
 }
 
 if (($paymoney.text()).indexOf(".") != -1) {
 return;
 }
 
 if (($paymoney.text()).indexOf(".") != -1) {
 return;
 }
 $paymoney.text($paymoney.text() + $(this).text());
 });
 $('.pay').click(function () {
 alert("支付金額為"+$paymoney.text())
 });
 })
</script>
<!--自適應(yīng)布局-->
<script>
 (function () {
 var designW = 750; //設(shè)計(jì)稿寬
 var font_rate = 100;
 //適配
 document.getElementsByTagName("html")[0].style.fontSize = document.body.offsetWidth / designW * font_rate + "px";
 document.getElementsByTagName("body")[0].style.fontSize = document.body.offsetWidth / designW * font_rate + "px";
 
 //監(jiān)測(cè)窗口大小變化
 window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () {
 document.getElementsByTagName("html")[0].style.fontSize = document.body.offsetWidth / designW * font_rate + "px";
 document.getElementsByTagName("body")[0].style.fontSize = document.body.offsetWidth / designW * font_rate + "px";
 }, false);
 })();
</script>
</html>

css

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@CHARSET "UTF-8";
html,body{
 background-color:#fff;
}
.pay-top{
 position: absolute;
 width: 100%;
 height:60%;
 background: #fff;
}
.pay-shop-info {
 position: absolute;
 width: 90%;
 left:5%;
 text-align: right;
 top:3.4rem;
 font-size:0.3rem ;
 }
 
.paymoneylogo {
 position: absolute;
 width: 90%;
 left:5%;
 top:4rem;
 height: 1.3rem;
 border-bottom: 0.02rem solid #bfbfbf;
 -webkit-border-radius: 0.02rem;
 -moz-border-radius: 0.02rem;
 border-radius: 0.02rem;
 background: #fff;
}
.inputlabel{
 position: absolute;
 width: 90%;
 left:5%;
 top:4rem;
 height: 1.3rem;
 text-align: right;
}
.lklogo{
 position: absolute;
 height: 1.2rem;
 width: 50%;
 left:25%;
 top:0.8rem;
}
.payinfo{
 display:none;
}
.payinfo .paynum {
 font-size: 0.6rem;
 color: #424857;
}
 
.payinfo .payzero {
 font-size: 0.6rem;
 color: #424857;
}
table{
 width:100%;
 height:50%;
 position:absolute;
 bottom:0;
 background-color:white;
 background-top:none;
}
table tr td{
 text-align:center;
 width: 1.88rem;
 height: 1.26rem;
 font-family: "Microsoft YaHei";
 font-weight: normal;
 border-right:1px solid #D9D9D9;
 border-top:1px solid #D9D9D9;
}
table tr td:active{
 background-color:#ECECEC;
}
.keybord-return{
 width: 1.88rem;
 height: 1.26rem;
 background:url(../img/keybord_return.png) no-repeat;
 background-size: 50% 50%;
 background-position: center;
}
.pay{
 color:#fff;
 font-size:0.4rem;
 background-color:#0259a1;
}
.pay:active{
 background-color: #004198;
}
.pay a{
 display: block;
 position: relative;
 width: 100%;
 height: 100%;
 color: #fff;
 text-decoration: none;
}
.a-pay {
 position: absolute;
 top: 50%;
 left: 50%;
 -webkit-transform: translate(-50%, -50%);
 -o-transform: translate(-50%, -50%);
 -moz-transform: translate(-50%, -50%);
 transform: translate(-50%, -50%);
}
.pay-disabled {
 background-color: #0259a1;
}

附帶上退格符,將其放項(xiàng)目的img文件中,否則數(shù)字鍵盤(pán)退格符無(wú)法顯示:

Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://blog.csdn.net/botellei/article/details/111444970

延伸 · 閱讀

精彩推薦
  • js教程微信小程序自定義modal彈窗組件的方法詳解

    微信小程序自定義modal彈窗組件的方法詳解

    這篇文章主要給大家介紹了關(guān)于微信小程序自定義modal彈窗組件的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)...

    遇見(jiàn)小美好11862021-12-15
  • js教程Javascript實(shí)現(xiàn)漢字和拼音互轉(zhuǎn)的終極方案

    Javascript實(shí)現(xiàn)漢字和拼音互轉(zhuǎn)的終極方案

    網(wǎng)上關(guān)于JS實(shí)現(xiàn)漢字和拼音互轉(zhuǎn)的文章很多,但是比較雜亂,有的不支持多音字、不支持聲調(diào)或者字典文件太大,無(wú)法根據(jù)實(shí)際需要滿足需求。這篇文章給...

    我是小茗同學(xué)9972021-12-15
  • js教程微信小程序?qū)崿F(xiàn)modal彈出框遮罩層組件(可帶文本框)

    微信小程序?qū)崿F(xiàn)modal彈出框遮罩層組件(可帶文本框)

    這篇文章主要給大家介紹了關(guān)于微信小程序?qū)崿F(xiàn)modal彈出框遮罩層組件(可帶文本框)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者...

    BadmintonCode3352021-12-15
  • js教程JavaScript中arguments的使用方法詳解

    JavaScript中arguments的使用方法詳解

    這篇文章主要給大家介紹了關(guān)于JavaScript中arguments的使用方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的...

    等待的L先生3512021-12-15
  • js教程js事件模型與自定義事件實(shí)例解析

    js事件模型與自定義事件實(shí)例解析

    JavaScript一個(gè)最簡(jiǎn)單的事件模型,需要有事件綁定與觸發(fā),還有事件刪除。本文將對(duì)其具體實(shí)現(xiàn)代碼進(jìn)行解析,需要的朋友一起來(lái)看下吧...

    caihg5472021-12-15
  • js教程微信小程序?qū)W習(xí)之自定義滾動(dòng)彈窗

    微信小程序?qū)W習(xí)之自定義滾動(dòng)彈窗

    這篇文章主要給大家介紹了關(guān)于微信小程序?qū)W習(xí)之自定義滾動(dòng)彈窗的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考...

    юноша8942021-12-15
  • js教程javascript的事件描述

    javascript的事件描述

    本文主要為大家介紹javascript事件的基礎(chǔ)知識(shí),有需要的朋友可以參考下...

    js教程網(wǎng)9342021-12-15
  • js教程Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

    Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán)

    這篇文章主要為大家詳細(xì)介紹了Jquery+javascript實(shí)現(xiàn)支付網(wǎng)頁(yè)數(shù)字鍵盤(pán),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一...

    юноша 25582021-12-15
主站蜘蛛池模板: 特级毛片免费视频观看 | 天天操天天做 | 天堂资源在线www中文 | 美女的隐私视频免费看软件 | 国产成年人网站 | caoporm国产精品视频免费 | gogort人体的最新网站 | 美女扒开胸罩露出胸大乳 | 国产高清国内精品福利 | 三星w699 | 女同学高中你下面好紧 | 日本无卡码一区二区三区 | 日本女人www| chinese军人@gay | 香蕉精品| 国产一久久香蕉国产线看观看 | 国产清纯91天堂在线观看 | 国产亚洲精品精品国产亚洲综合 | 情趣内衣情趣玩具play | 校园全肉高h湿一女多男 | 黑人巨大精品战中国美女 | 天天色天天综合 | 亚洲欧美日韩中文字幕网址 | eeuss18影院www国产 | 日本sss在线高清观看 | 性奶老妇 视频 | 古装全套 毛片 | xx18-19xxxxhd| 1024亚洲精品国产 | 亚洲欧美天堂 | 99久久国产综合精品女小说 | 美女扒开肌肌让男人桶 | 果冻传媒天美传媒网址入口 | china中国xxxxfree china国产bbw | 91视频破解 | 国产亚洲欧美在线中文bt天堂网 | 国内精品中文字幕 | 热99在线视频 | 啪啪无尽3d动漫漫画免费网站 | 国产亚洲精品aaa大片 | 狠狠干综合网 |