随笔分类 -  前端(html)

摘要:1 function ConvertToUpperCase(n) { 2 if (n == 0 || n == "0" || !n) { 3 return "零元整"; 4 } 5 //n = n * 10000; 6 if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) { 阅读全文
posted @ 2024-10-18 17:16 常威打来福 阅读(90) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2021-08-06 18:54 常威打来福 阅读(235) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script src="../js/jquery-1.9.1.min.js"></script> 6 <script src="../js/jquery-ui.min.js 阅读全文
posted @ 2020-12-16 16:08 常威打来福 阅读(405) 评论(0) 推荐(0)
摘要:1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <!-- 引用本地jquery文件 --> 7 <script src="../script/jquery-1.9.1.min.js">< 阅读全文
posted @ 2020-11-24 12:05 常威打来福 阅读(323) 评论(0) 推荐(0)
摘要:var ret=''; $('name=chkIds').each(function(){ if($(this).is(':checked')){ ret+=$(this).val()+','; } }); //打印结果 console.log(ret); 阅读全文
posted @ 2019-11-26 10:53 常威打来福 阅读(341) 评论(0) 推荐(0)
摘要:1.限制只能输入正数和小数保留小数点后两位 1 <input type="number" id="txtNum" /> 2 3 <script type="javascript"> 4 $(function(){ 5 $("#txtNum").keyup(function () { 6 $(this 阅读全文
posted @ 2019-11-12 10:09 常威打来福 阅读(11668) 评论(1) 推荐(0)
摘要:在输入框样式中加入: line-height:20px; 阅读全文
posted @ 2019-10-11 10:58 常威打来福 阅读(1027) 评论(0) 推荐(0)
摘要:下载文件方法: window.location.href='http://www.baidu.com/down/downFile.txt?name=资源文件'; 这种情况下载时:文件名资源文件会中文乱码,解决办法:encodeURI(fileUrl, "utf-8"); var newFileUrl 阅读全文
posted @ 2019-08-02 11:29 常威打来福 阅读(7195) 评论(0) 推荐(0)
摘要:var msg='A|B|C|D|E|F|G'; 方式1: var newMsg=msg.replace("|",""); 方式2: ps:适用特殊字符 var newMsg2 = msg .replace(new RegExp("&lt;br /&gt;","gm"),"<br/>") 阅读全文
posted @ 2019-07-30 11:33 常威打来福 阅读(633) 评论(0) 推荐(1)
摘要:吃饭 睡觉 打豆豆 玩游戏 代码如下: 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <!-- <script src="http://code.jquery.com/jquery-1 阅读全文
posted @ 2019-07-19 18:57 常威打来福 阅读(7824) 评论(0) 推荐(0)
摘要:<script type="javascrpit"> var url='';//需要跳转的页面 var search = window.location.search; if(search){ if(url.indexOf("?")!=-1) { url+="&"; }else { url+="?" 阅读全文
posted @ 2019-04-15 10:35 常威打来福 阅读(289) 评论(0) 推荐(0)
摘要:<input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" /> 阅读全文
posted @ 2019-03-28 17:16 常威打来福 阅读(567) 评论(0) 推荐(0)
摘要:function CheckTxtLength(txt) { var num = txt.replace(/[^\x00-\xff]/g, 'xx').length; if (num <=11) { return true; } return false; } 注:11代表最大长度 num代表 该文 阅读全文
posted @ 2016-09-22 16:02 常威打来福 阅读(5411) 评论(0) 推荐(0)
摘要://将奖励转换成json格式 _page.StrRewardToJson = function () { var hdReward = $("#hdReward").find("option:selected").text(); var ltReward = $("#ltReward").find( 阅读全文
posted @ 2016-06-25 16:07 常威打来福 阅读(203) 评论(0) 推荐(0)
摘要:如果要我们要把整个form1表单中的输入框都传过去可以用data:$("#form1").serialize(), 但是我们如果还要传一个不在form中的值呢? 可以使用下面这种方法: var n=$("#form1").serialize();n+="&obj="+obj; data:n, 就可以 阅读全文
posted @ 2016-06-25 11:14 常威打来福 阅读(337) 评论(0) 推荐(0)