Code funktioniert nicht außerhalb einer jsFiddle

Ich möchte eine Webseite mit interaktiven Videos erstellen, und als ich hier suchte, bin ich auf einen Link gestoßen, der auf einen verweistjsFiddle, das meinen Bedürfnissen entspricht.

Da der Code auf der jsFiddle einwandfrei funktionierte, brach er zusammen, als ich versuchte, ihn in DreamWeaver zu kopieren (anscheinend funktionierte JavaScript nicht mehr).

Ich hatte alles so zusammengestellt:

<code><html>
    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="sgrub.js"></script>
    <script>
        $('#video_1, #video_2').hide();

        $('.icon_1').click(function() {
            $('#video_2').fadeOut(function() {
                $('#video_1').fadeIn();
            });
        });

        $('.icon_2').click(function() {
            $('#video_1').fadeOut(function() {
                $('#video_2').fadeIn();
            });
        });

        $('.icon_1').click(function() {

            $('.video_2').get(0).pause();
            $('.video_2').get(0).currentTime = 0;
            $('.video_1').get(0).play();
        });

        $('.icon_2').click(function() {
            $('.video_1').get(0).pause();
            $('.video_1').get(0).currentTime = 0;
            $('.video_2').get(0).play();
        });

    </script>
    <head></head>
    <body>
        <div class="icon_1" id="mediaplayer">
            cadillac
        </div>
        <div class="icon_2" id="mediaplayer2">
            nike
        </div>
        <div id="video_1">
            <video class="video_1" width="50%" height="50%" controls="controls"
            poster="http://www.birds.com/wp-content/uploads/home/bird.jpg">
                <source src="http://video-js.zencoder.com/oceans-clip.mp4"
                type="video/mp4" />
            </video>
        </div>
        <div id="video_2">
            <video class="video_2" width="50%" height="50%" controls="controls"
            poster="http://www.birds.com/wp-content/uploads/home/bird.jpg">
                <source src="images/01.mp4" type="video/mp4" />
            </video>
        </div>
    </body>
</html>
</code>

Ich habe versucht, das JavaScript in einen jQuery DOM-Ready-Aufruf einzubinden, ohne Erfolg:

<code>$(document).ready(function() {
    // The JavaScript here
});
</code>

Antworten auf die Frage(2)

Ihre Antwort auf die Frage