分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

js实用小函数收集

发布时间:2023-09-06 01:39责任编辑:熊小新关键词:js

格式化金额

var val=‘212312.235423‘var rex = /\d{1,3}(?=(\d{3})+$)/g;val.replace(/^(-?)(\d+)((\.\d+)?)$/, function (s, s1, s2, s3) { ?????????return ‘$‘ + s1 + s2.replace(rex, ‘$&,‘) + s3; })
创建表单,并以post方式提交 
$(".details").click(function(){ ?????????????var type=$(this).attr("type"); ???????????var financingAmount=$(this).attr("financingAmount"); ???????????var ?url = "/supplierAccountCenterController/suppliereceivingadd"; ???????????//首先创建一个form表单 ?????????????var tempForm = document.createElement("form"); ???????????????tempForm.id="tempForm1"; ?????????????tempForm.method="post"; ??????????????tempForm.action=url; ?????????????tempForm.target="_blank"; ??????????????//创建input标签,用来设置参数 ?????????????var hideInput = document.createElement("input"); ???????????????hideInput.type="hidden"; ???????????????hideInput.name= "type"; ?????????????hideInput.value= type; ????????????????????????//将input表单放到form表单里 ?????????????tempForm.appendChild(hideInput); ????????????????????????//将此form表单添加到页面主体body中 ?????????????document.body.appendChild(tempForm); ????????????tempForm.submit(); ???????????document.body.removeChild(tempForm); } ??????????
$.ajaxSetup({cache:false}); 设置ajax非缓存机制

 

判断是否为IE浏览器js代码: (! +[1, ]);
 

js实用小函数收集

原文地址:https://www.cnblogs.com/codechange/p/8367110.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved