<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<title>拼字符串</title>
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
</head>
<body>
<div>
<input type="radio" name="type" id="myType" value="sql.append" checked="checked">sql.append()
<input type="radio" name="type" id="myType1" value="str.append">str.append()
<input type="radio" name="type" id="myType2" value="buffer.append">buffer.append()
<input type="radio" name="type" id="myType3" value="sb.append">sb.append()
<input type="button" value="生成" οnclick="createSQL();"></input>
</div>
<div id="value">
<textarea id="myValue" style="width: 50%;height: 500px;"></textarea>
</div>
</body>
<script type="text/javascript">
function createSQL(){
var partten = "";
$(':radio').each(function(val){
if($(this).attr('checked')=='checked'){
partten = $(this).val();
return;
}
});
var myValue = $('#myValue').val();
var every = myValue.split('\n');
var value = "";
for(var i=0;i<every.length;i++){
if(every[i]!=null && every[i]!=' ')
value+=partten+"(\""+every[i]+"\")"+";"+"\n";
}
$('#myValue').val(value);
}
</script>
</html>
拼接字符串
最新推荐文章于 2022-11-26 13:23:25 发布