如何将获得的一段文字分成2段放入2个文本框里
如何将获得的一段文字分成2段放入2个文本框里
------解决方案-------------------- <body>
<script language= "JavaScript1.2 ">
<!--
str= "aaaaaaaaaaa ";
alert(str.substr(0,60));
//-->
</script>
</body>
------解决方案--------------------txt=request( "txt ")
<body>
<input type= "text " name= "t1 "> <br>
<input type= "text " name= "t2 ">
</body>
<script>
var str = " <%=txt%> ";
if(str.length> 60)
{
document.getElementById( "t1 ").value=str.substr(0,60);
document.getElementById( "t2 ").value=str.substr(61,str.length);
}
else
{
document.getElementById( "t1 ").value=str;
document.getElementById( "t2 ").value= " ";
}
</script>