在项目开发中难免遇到通过javascript
莱按照某个字符在过滤或截取字符串
例如需要截取的字符串是 test-hello-world 就可以使用下面的方法
明天写一下昨晚研究的关于javascript回调服务器端方法的示例
莱按照某个字符在过滤或截取字符串
例如需要截取的字符串是 test-hello-world 就可以使用下面的方法
<
script language
=
"
javascript
"
type
=
"
text/javascript
"
>
function OnCallback(strUserInfo,context)
{
// result.innerText=strUserInfo;
document.getElementById( ' TextBox1 ' ).value = strUserInfo;
var stt = strUserInfo;
document.getElementById( ' TextBox2 ' ).value = stt.split( " - " )[ 0 ];
document.getElementById( ' TextBox3 ' ).value = stt.split( " - " )[ 1 ];
document.getElementById( ' TextBox4 ' ).value = stt.split( " - " )[ 2 ];
// document.write(stt.split("-")[0]);
// document.write(stt.split("-")[1]);
// document.write(stt.split("-")[2]);
}
</ script >
function OnCallback(strUserInfo,context)
{
// result.innerText=strUserInfo;
document.getElementById( ' TextBox1 ' ).value = strUserInfo;
var stt = strUserInfo;
document.getElementById( ' TextBox2 ' ).value = stt.split( " - " )[ 0 ];
document.getElementById( ' TextBox3 ' ).value = stt.split( " - " )[ 1 ];
document.getElementById( ' TextBox4 ' ).value = stt.split( " - " )[ 2 ];
// document.write(stt.split("-")[0]);
// document.write(stt.split("-")[1]);
// document.write(stt.split("-")[2]);
}
</ script >