문제

New to all of this and trying to get my .js script to work in Coda2. If anyone has any idea of why the .js script file is not responding, that would be great!

Thank you in advance!

<!DOCTYPE html>
<html>
<head>
    <title>Button Magic</title>
    <link rel='stylesheet' type='text/css' href='stylesheet.css' />
    <script type= 'text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
    <script type= 'text/javascript' src='script.js'></script>
</head>
<body>
    <div><br/><strong>Click Me!</strong></div>
</body>

In the script:

$(document).ready(function() {
$('div').mouseenter(function() {
    $('div').fadeTo('fast',1);
});
$('div').mouseleave(function(){
    $('div').fadeTo('fast',0.5);
});

});

Please find the image here of my code:

http://postimg.org/image/qis0sitd1/

도움이 되었습니까?

해결책 2

You have to include the jQuery library. You can use the Google CDN for that:

<!DOCTYPE html>
<html>
    <head>
        <title>Button Magic</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css' />
        <script type= 'text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>
        <script type= 'text/javascript' src='script.js'></script>
    </head>
    <body>
        <div><br/><strong>Click Me!</strong></div>
    </body>
</html>

다른 팁

You haven't added a script tag to include jQuery.

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js' type='text/javascript'></script>

You haven't included the Jquery lib, please include one.

eg: http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top