小编Swa*_*dra的帖子

安装自耕农的问题

我正在尝试安装yeoman但我收到以下错误消息:

我确实安装了node.js和npm(最新版本),现在我正在这样做

npm install -g yo grunt-cli bower

and 

npm install -g yo 
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误消息

npm http GET https://registry.npmjs.org/yo
npm http 200 https://registry.npmjs.org/yo

npm ERR! Error: No compatible version found: yo
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR!     at /usr/share/npm/lib/cache.js:408:5
npm ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report …
Run Code Online (Sandbox Code Playgroud)

javascript web-development-server node.js npm yeoman

2
推荐指数
2
解决办法
3021
查看次数

window.location.assign("link"),无效

这是javascript代码.

<script type="text/javascript">
        function myfunc()
        {
            var filmName = document.getElementById("mysearch-text").value;
            alert(filmName);
            if(filmName == "parker")
                 window.location.assign("http://www.google.com");
            else
                alert("hello");

        }       
    </script>
Run Code Online (Sandbox Code Playgroud)

如果我输入任何其他字符串,我会收到"hello"警告,如果我输入"parker"页面" http://www.google.com "将无法加载.为什么会这样?

编辑:好的,如有人提到我删除" http://www.google.com "并添加" http://stackoverflow.com ",但它没有解决我的问题.我甚至无法加载位于同一目录中的本地html页面

if(filmName == "parker")
                 window.location.assign("index.html"); // also "./index.html" or ./index/html
Run Code Online (Sandbox Code Playgroud)

即便这样也行不通.怎么了

我也有jquery库:那就是Jquery UI和Jquery

这个问题我需要更多的信息.以下是最终的修改

<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8" />
  <!-- Other style and js libraries, including Jquery Ui and regular jquery -->

 <script>
   $(document).ready(function() {
    $(".youtube").fancybox();
   }); // end ready
</script>

<script>    
  $(document).ready(function(e) { 
    $('.tooltip').hide();
    $('.trigger').mouseover(function() {
    /* Rest of …
Run Code Online (Sandbox Code Playgroud)

html javascript css

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

Python if语句不起作用?

我刚开始学习python,通过"像计算机科学家一样思考"这本书,我陷入了一些语言语法.

def amt():
    amount = input("Enter your amount: ")
    amount = int(amount)
    if amount >= 20:
        twe = amount / 20
        amount = amount - twe * 20
            print("You need to pay %d twenty dollar bills" %(twe))
    if amount >= 10:
        ten = amount / 10
        amount = amount - ten * 10
        print("You need to pay %d ten dollar bills" %(ten))
    if amount >= 5:
        five = amount / 5
        amount = amount - five * 5
        print("You need …
Run Code Online (Sandbox Code Playgroud)

python if-statement conditional-statements

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