function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form1; }
else { theform = document.forms["Form1"]; }
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument; theform.submit();
} 哪位高手帮忙解释一下eventTarget.split("$").join(":"); 这句话具体是什么意思?谢谢了
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form1; }
else { theform = document.forms["Form1"]; }
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument; theform.submit();
} 哪位高手帮忙解释一下eventTarget.split("$").join(":"); 这句话具体是什么意思?谢谢了
str="aaaaa$ljjkjkjk$ldkjfalkjfk$lllll";
str=str.split("$").join(":");
执行后就为
str="aaaaa:ljjkjkjk:ldkjfalkjfk:lllll";
把字符串用"$"分隔成数组,在把数组的所有元素用":"连成新字符串
.net生成的 theform.__EVENTTARGET.value 是传递 postback 后需处理的服务器端控件名称根据 这个 值 开判断 是什么控件的事件需要 后台处理
<option value="20083">1</option> <option value="20077">2</option>
</select>
可是这段代码,选择1或2的时候,调用__doPostBack这个函数,会显示相关的内容,我在
theform.__EVENTTARGET.value = eventTarget.split("$").join(":"); 后面加
alert (theform.__EVENTTARGET.value);
弹出的内容显示"ddlExpect",并没有看到20083或者20077啊?
只有一个ddlExpect,那程序是怎么得到20083或20077的?然后输出相关数据?
所以用
split(分隔符).join(合并符) 来取代 replace