WEB开发网
开发学院网页设计JavaScript 用 E4X 和 Prototype 创建 Ajax mindreader 应用程... 阅读

用 E4X 和 Prototype 创建 Ajax mindreader 应用程序,第 1 部分: 构建 Twenty Questions 基础结构

 2010-03-09 00:00:00 来源:WEB开发网   
核心提示: 清单 3. 创建知识库kdata=<knowledgebase><questions><questionid="1"><display>Isitanimal,vegetable,ormineral?</display>

清单 3. 创建知识库

kdata = 
<knowledgebase> 
  <questions> 
    <question id="1"> 
     <display>Is it animal, vegetable, or mineral?</display> 
     <answerOption>Animal</answerOption> 
     <answerOption>Vegetable</answerOption> 
     <answerOption>Mineral</answerOption> 
    </question> 
    <question id="2"> 
     <display>Does it bark?</display> 
     <answerOption>Yes</answerOption> 
     <answerOption>No</answerOption> 
    </question>   
  </questions> 
  <targets> 
   <target id="1"> 
     <display>a house cat</display> 
     <answer questionid="1"><answerValue1>Animal</ 
                 answerValue1></answer> 
     <answer questionid="2"><answerValue2>No</ 
                 answerValue2></answer> 
   </target> 
    <target id="4"> 
     <display>a dog</display> 
     <answer questionid="1"><answerValue1>Animal</ 
                answerValue1></answer> 
     <answer questionid="2"><answerValue2>Yes</ 
                answerValue2></answer> 
   </target>    
   <target id="2"> 
     <display>a carrot</display> 
     <answer questionid="1"><answerValue1>Vegetable</ 
                  answerValue1></answer> 
   </target> 
   <target id="3"> 
     <display>a ruby</display> 
     <answer questionid="1"><answerValue1>Mineral</ 
                answerValue1></answer> 
   </target> 
  </targets> 
</knowledgebase>; 
 
knowledgeBase = new XML(kdata);   

编缉推荐阅读以下文章

  • 用 E4X 和 Prototype 创建 Ajax mindreader 应用程序,第 2 部分: 使 mindreader 应用程序更智能化

上一页  1 2 3 4 5 6 7 8 9 10  下一页

Tags:EX Prototype 创建

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接