简体   繁体   English

Ubuntu 12.04 LTS中的基因敲除.js和.htaccess

[英]knockout.js and .htaccess in ubuntu 12.04 lts

HTML file HTML文件

<div id="demo">
  <p>First name: <strong data-bind="text: firstName"></strong></p>
  <p>Last name: <strong data-bind="text: lastName"></strong></p>
  <button data-bind="click: myFunctionSave">Save</button>
  <button data-bind="click: myFunctionCancel">Cancel</button>
</div>
<script type='text/javascript' src='ViewModel/knockout-2.3.0.js'></script>
<script type='text/javascript' src='ViewModel/main.js'></script>

JavaScript file JavaScript文件

function myFunctionSave() {
   this.firstName = "save";this.lastName = "saveSurname";
 }
 function myFunctionCancel() {
   this.firstName = "cancel";this.lastName = "cancelSurname";
 }
  ko.applyBindings(new myFunctionSave());
  ko.applyBindings(new myFunctionCancel());

.htaccess .htaccess

I'm unable to create a .htaccess in ubuntu 12.04 lts. 我无法在Ubuntu 12.04 LTS中创建.htaccess。 I have unhided it and even done all in Apache from none but still it is redirecting to the localhost home page and says "YES ITS WORKING" but not redirected to index.html. 我已经取消隐藏它,甚至没有在Apache中完成所有操作,但是仍然将其重定向到localhost主页,并说“是的”,但是没有重定向到index.html。

tried this code it is working html file 尝试此代码,它正在工作的HTML文件

<div class='demo'> 
 <button data-bind='click: save'>save</button>
 <button data-bind='click: cancel'>cancel</button>
</div>
<script type='text/javascript' src='ViewModel/knockout-2.3.0.js'></script>
<script type='text/javascript' src='ViewModel/main.js'></script>

javascript file javascript文件

 var student = function() {
   var self = this;
   self.save = function() { alert("save" );  };
    self.cancel = function() { alert("cancel" );  };
 };
 ko.applyBindings(new student());

but why this code is not working html file 但是为什么此代码无法正常工作的html文件

  <div class='demo'> 
 <p>First name: <strong data-bind="text: firstName"></strong></p>
 <p>Last name: <strong data-bind="text: lastName"></strong></p>
 <button data-bind='click: save'>save</button>
 <button data-bind='click: cancel'>cancel</button>
  </div>
  <script type='text/javascript' src='ViewModel/knockout-2.3.0.js'></script>
  <script type='text/javascript' src='ViewModel/main.js'></script>

javscript file 档案文件

var student = function() {
    var self = this;
    self.save = function() { alert("save" ); 
         self.firstName="save";      
         self.lastName="saveLastname";  };
    self.cancel = function() { alert("cancel" );
         self.firstName="cancel";
         self.lastName="cancelLastname"; };
   };

ko.applyBindings(new student()); ko.applyBindings(new student());

please help 请帮忙

确保已在Apache中启用了mod_rewrite(开箱即用未启用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM