<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> jquery 字符串切割函数substring的用法说明 </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META NAME="Author" CONTENT="Fanglor">
<META NAME="Keywords" CONTENT="jquery 字符串切割 函数 substring 用法">
<META NAME="Description" CONTENT="jquery 字符串切割 函数 substring 用法">
<script type="text/javascript" src="jquery.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function sclip () {
if($("#txt1").val().length > 6) {
$("#txt2").val($("#txt1").val().substring(0,6));
}else {
$("#txt2").val($("#txt1").val());
}
}
//-->
</SCRIPT>
</HEAD>
<input type="text" id="txt1" />
<input type="text" id="txt2" />
<input type="button" onClick="sclip();" value="do it ..."/>
<BODY>
</BODY>
</HTML>