dqrb4228 2013-07-30 08:51
浏览 71

在yii中使用jquery

Iam using javascript chosen ( http://harvesthq.github.com/chosen/ ) plugin in yii to get multiple input from dropdown list.Iam using this code :-

    <!doctype html> 
<html lang="en"> 
<head>

  <link rel="stylesheet" href="chosen/chosen.css" />
</head>
<body>
    <h2>Multiple Select</h2>
    <div>

      <div>    
        <select data-placeholder="Choose a Country..." class="chzn-select" multiple style="width:350px;" tabindex="4">
          <option value=""></option> 
          <option value="United States">United States</option> 
          <option value="United Kingdom">United Kingdom</option> 
          <option value="Afghanistan">Afghanistan</option> 

        </select>
      </div>
    </div>


  <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
  <script src="chosen/chosen.proto.js" type="text/javascript"></script>
  <script type="text/javascript">
  document.observe('dom:loaded', function(evt) {
    var select, selects, _i, _len, _results;
    if (Prototype.Browser.IE && (Prototype.BrowserFeatures['Version'] === 6 || Prototype.BrowserFeatures['Version'] === 7)) {
      return;
    }
    selects = $$(".chzn-select");
    _results = [];
    for (_i = 0, _len = selects.length; _i < _len; _i++) {
      select = selects[_i];
      _results.push(new Chosen(select));
    }
    deselects = $$(".chzn-select-deselect");
    for (_i = 0, _len = deselects.length; _i < _len; _i++) {
      select = deselects[_i];
      _results.push(new Chosen(select,{allow_single_deselect:true}));
    }
    return _results;
  });
  </script>
</body>
</html>

It is well working when running as a simple project including the resources chosen.jquery.js,chosen.jquery.min.js,chosen.proto.js,chosen.proto.min.js in another folder named chosen. But it is not working, when implemented the same in a yii project. Is there any extra code fragments required for it to make the plugin work in Yii ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?