zoukankan      html  css  js  c++  java
  • 转义符输入的转换

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8">
    		<title></title>
    	</head>
    	<body>
    		<input type="text" id="input">  
    		<input type="text" id="b">
    		<button  onclick="trans()">转换</button>
    		<script>
    			
    			function trans(){
    				var a = document.querySelector('#input')
    				var b = document.querySelector('#b')				
    				const obj = {
    					value :a.value,
    					value2:b.value
    				}
    				console.log(JSON.stringify(obj).replace(/\\/ig,"u005c"),"stringify")
    			}
    		</script>
    	</body>
    </html>
    
  • 相关阅读:
    瀑布流
    轮播图
    封装动画的函数
    回到顶部带动画
    动画setInterval
    模拟滚动条
    放大镜
    刷新
    cookie
    拖拽
  • 原文地址:https://www.cnblogs.com/chengyunshen/p/13436833.html
Copyright © 2011-2022 走看看