嗨我在XML中有javascript代码。如果我在javascipt中编写循环函数,我的代码会中断。
{
<script language="javascript">
IWEventRegistry.addFormHandler("onForminit",init);
var NextPath="/iwmnt/default/main/sandbox/EDITION/";
IWEventRegistry.addItemHandler("/Config/NextEditionVpathD","onItemChange",concatPath);
IWEventRegistry.addItemHandler("/Config/PreviousEditionD","onItemChange",setPrev);
function init()
{
alert("Hello");
var server = window.location.hostname;
var param=new Object();
var callUrl1= "http://"+server+"/iw-cc/teamsite/genEditions.jsp?path1="+NextPath;
IWDatacapture.callServer(callUrl1,param,true);
alert("INIT End");
}
function genIds1(item)
{
var str=item.toString();
alert(str);
var n=str.split("-");
alert("Length is "+n.length);
item1=IWDatacapture.getItem("/Config/PreviousEditionD");
alert("Item1 "+ item1);
for(var i=0;i<n.length-1;i++)
{
alert(n[i]);
}
}
function concatPath()
{
var item = IWDatacapture.getItem("/Config/NextEditionVpathD").getValue();
var path=NextPath+item;
IWDatacapture.getItem("/Config/NextEditionVpath").setValue(path);
alert("Next Edition "+IWDatacapture.getItem("/Config/NextEditionVpath").getValue());
}
function setPrev()
{
var item = IWDatacapture.getItem("/Config/PreviousEditionD");
var item1=item.getOptions()[item.getValue()].value;
IWDatacapture.getItem("/Config/PreviousEdition").setValue(item1);
alert("previous Edition " +item1);
}
</script>
}
如果我不使用for循环,这个代码工作正常,但是在for循环之后,在执行时它在Title中提到的给出错误。你能告诉我怎么解决它。
{org.apache.xmlbeans.XmlException:error:遇到意外字符(lex state 8):';'} 感谢