拼接字符串

来源:互联网 发布:爱的归宿网络电影 编辑:程序博客网 时间:2022/05/28 04:59
<%@ 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="生成" onclick="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>

0 0
原创粉丝点击