替换掉文本域中指定的字符串



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script type="text/javascript" src="jquery.js"></script>
 </head>

 <body>
  <input type="checkbox" id="c1" onclick="checkthis();"/>
  <TEXTAREA STYLE="overflow:hidden" ID="t1">
</TEXTAREA>


 </body>
</html>
<script type="text/JavaScript">
function checkthis(){
	if($("#c1").attr("checked")){
		$("#t1").val("c1;c1;");
	}else{
		if ($("#t1").val().indexOf("c1;") >= 0)
		{
   			$("#t1").val($("#t1").val().replace(/c1;/g,""));
		}
	}
}

</script>

你可能感兴趣的:(java,html)