欢迎来到天天文库
浏览记录
ID:9295877
大小:66.14 KB
页数:4页
时间:2018-04-27
《domino下拉框的二级联动菜单》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、下拉框的二级联动菜单首先有两个联动菜单,如下图:我们现在要根据SampleType的值来改变SampleName的值。我们先看一下视图的结构我们通过ajax从后台获取xml,然后放到SampleName里面:当SampleType的值改变时我们调用addSampleNamebyajax方法:Javascript://通过ajax动态加载样品名称functionaddSampleNamebyajax(samplevalue){try{varuri="";uri="&SampleType="+sampleva
2、lue+"&ids="+Math.random();varloader=dhtmlxAjax.getSync("<计算的值>Agent_getSapmleNameByAjax?OpenAgent"+uri);cResponseSampleName(loader);}catch(err){alert(err.description);}}//回调函数functioncResponseSampleName(loader){try{if(loader.xmlDoc.responseXML!=null){//清除
3、数据document.getElementById("SampleName").options.length=1;//获取ajax的xml数据varxmlDoc=loadXMLDoc(loader.xmlDoc.responseXML);vartemp=xmlDoc.getElementsByTagName("cell");for(i=0;i4、empStr)document.getElementById("SampleName").add(option);}}}catch(err){alert(err.description)}}functionloadXMLDoc(dname){try{xmlDoc=newActiveXObject("Microsoft.XMLDOM");}catch(e){try{xmlDoc=document.implementation.createDocument("","",null);}catch(e){aler5、t(e.message)}}try{xmlDoc.async=false;xmlDoc.load(dname);return(xmlDoc);}catch(e){alert(e.message)}return(null);}Lotusscript:SubInitialize'Msgbox"-----------------------"OnErrorGotohandleDimsessionAsNewNotesSessionDimcurdocAsNotesDocumentDiminputStrAsStrin6、gDimviewAsNotesViewDimcurdbAsNotesDatabaseDimtempdocAsNotesDocumentDimdcAsNotesDocumentCollectionDimSampleNameAsStringDimouputStrAsStringSetcurdb=session.CurrentDatabaseSetcurdoc=session.DocumentContext'inputStr=curdoc.GetItemValue("Query_String_Decoded")7、(0)inputStr=GetParameter("SampleType",curdoc.GetItemValue("Query_String_Decoded")(0))'MsgboxinputStrSetview=curdb.GetView("View_znnysc_SampleType")Setdc=view.GetAllDocumentsByKey(inputStr+"8、"+inputStr,True)Msgboxdc.CountSettempdoc=dc.GetFirstDocumentoutpu9、tStr={}WhileNottempdocIsNothingSampleName=tempdoc.SampleTypeName(0)outputStr=outputStr+{}+SampleName+{}MsgboxSampleNameSettempdoc=dc.GetNextDocument(tempdoc)WendoutputStr=outputStr+{}Print{Co
4、empStr)document.getElementById("SampleName").add(option);}}}catch(err){alert(err.description)}}functionloadXMLDoc(dname){try{xmlDoc=newActiveXObject("Microsoft.XMLDOM");}catch(e){try{xmlDoc=document.implementation.createDocument("","",null);}catch(e){aler
5、t(e.message)}}try{xmlDoc.async=false;xmlDoc.load(dname);return(xmlDoc);}catch(e){alert(e.message)}return(null);}Lotusscript:SubInitialize'Msgbox"-----------------------"OnErrorGotohandleDimsessionAsNewNotesSessionDimcurdocAsNotesDocumentDiminputStrAsStrin
6、gDimviewAsNotesViewDimcurdbAsNotesDatabaseDimtempdocAsNotesDocumentDimdcAsNotesDocumentCollectionDimSampleNameAsStringDimouputStrAsStringSetcurdb=session.CurrentDatabaseSetcurdoc=session.DocumentContext'inputStr=curdoc.GetItemValue("Query_String_Decoded")
7、(0)inputStr=GetParameter("SampleType",curdoc.GetItemValue("Query_String_Decoded")(0))'MsgboxinputStrSetview=curdb.GetView("View_znnysc_SampleType")Setdc=view.GetAllDocumentsByKey(inputStr+"
8、"+inputStr,True)Msgboxdc.CountSettempdoc=dc.GetFirstDocumentoutpu
9、tStr={}WhileNottempdocIsNothingSampleName=tempdoc.SampleTypeName(0)outputStr=outputStr+{}+SampleName+{}MsgboxSampleNameSettempdoc=dc.GetNextDocument(tempdoc)WendoutputStr=outputStr+{}Print{Co
此文档下载收益归作者所有