小编Nam*_*eo0的帖子

在Centos 6.3上运行'rails s'时,我得到一个'找不到JavaScript运行时'.错误

我搜索了互联网和stackoverflow的答案,但没有一个答案适合我,我无法将nodejs安装到我的服务器上.

我使用的是Rails 3.2.3,Ruby 1.9.3p374.

当我运行'bundle install'和'bundle update'时,我没有收到任何错误.

运行'rails s'后出现错误:

/home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@rails3tutorial2ndEd/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /home/Nameo0/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler.rb:128:in …
Run Code Online (Sandbox Code Playgroud)

javascript centos ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2

1
推荐指数
1
解决办法
1508
查看次数

Javascript更改HTML但更改然后立即默认回硬编码值

我试图做到这样,当我点击 html 中的提交按钮时,我们在输入字段中的值替换 P 元素内具有 id“numberz”的项目。

我可以得到代码来做到这一点,但网站立即变回在 P 元素中使用默认值,其 id 为“numberz”。

如何防止网站改回硬编码到 HTML 文件中的元素的默认值?

<!DOCTYPE html>

<html>
    <head>
        <title>JS test</title>
        <script>
            function e() {
                var x = document.getElementById("numberz");
                var z = document.getElementById("num").value;
                //alert(x.innerHTML + " s " + z);//
                x.innerHTML= z;
            };
        </script>
    </head>
    <body>
        <p>The number is:</p>
        <p id = "numberz">s</p>
        <br>
        <br>
        <form onsubmit = "return e();">
            <input id = "num" type = "text" size = "4" placeholder = "test"/>
            <input type = "submit" value = "Submit"/>
        </form> …
Run Code Online (Sandbox Code Playgroud)

html javascript

1
推荐指数
1
解决办法
1127
查看次数

悬停时<strong>和<h4>的问题

当我将鼠标悬停在表格中的h4标签上时,一切正常.但是,当我将鼠标悬停在位于h4元素内的强标记上时,强标记会获得与h4标记相同的悬停.

我有一个表元素,每个td元素的结构如下所示:

<td>
  <a>
    <div>
      <h4>
        ...<strong>...</strong>...
      </h4>
    </div>
  </a>
</td>
Run Code Online (Sandbox Code Playgroud)

这是影响表中元素的CSS.

h4 {
  font-weight: 100;
  margin: 0px;
  padding: 12px 0px;
  color: black;
}

a {
  text-decoration: none;
}

a:visited {
  color: white;
  background-color: none;
}

strong :hover {
  background: none !important;
  background-color: transparent !important;
}

/*Used for the gradient on hover for the background*/

.itemTrue > a > div :hover {
  color: white;
  background: #e4e4e4;
  background: -moz-linear-gradient(top,  #e4e4e4 0%, #295534 73%, #1d3923 88%, #000000 100%);
  background: -webkit-gradient(linear, left top, …
Run Code Online (Sandbox Code Playgroud)

html css hover

-1
推荐指数
1
解决办法
971
查看次数