jquery - Including JavaScript in HTML -
jquery - Including JavaScript in HTML -
i found online jquery sound plugin (no flash) part of script.aculo.us' sound.js (http://script.aculo.us), based on code jules gravinese (http://www.webveteran.com/).
doesn't work:
<script type="text/javascript" src="/data/js/sound.js"></script>
works:
<? include($_server['document_root']."/data/js/sound.js");?>
what should changed, test.php works normal include method? why script work query/1.4.2/jquery.min.js , not jquery/1.11.1/ or jquery-2.1.0.min.js
test.php
<img src="/bilder/flaggen/englisch.png" onclick="$.sound.play('http://translate.google.com/translate_tts?ie=utf-8&tl=en&q=test')" style="cursor:hand;cursor:pointer;">
sound.js
<script type="text/javascript"> (function($) { $.sound = { tracks: {}, enabled: true, template: function(src) { homecoming '<embed style="height:0" loop="false" src="' + src + '" autostart="true" hidden="true"/>'; }, play: function(url, options){ if (!this.enabled) return; var settings = $.extend({ url: url, timeout: 2000 }, options); if (settings.track) { if (this.tracks[settings.track]) { var current = this.tracks[settings.track]; // todo check when stop avaiable, not on jquery object current.stop && current.stop(); current.remove(); } } var element = $.browser.msie ? $('<bgsound/>').attr({ src: settings.url, loop: 1, autostart: true }) : $(this.template(settings.url)); element.appendto("body"); if (settings.track) { this.tracks[settings.track] = element; } if(options){ settimeout(function() { element.remove(); }, options.timeout) } homecoming element; } }; })(jquery); </script>
since file in .js
file, don't need:
<script type="text/javascript">
at beginning
and
</script>
at end
also, doesn't work latest version of jquery
because of updates in latest versions. alot of functions in older versions have either been removed or renamed in newer version.
every script uses jquery written , tested against particular version of jquery. sometimes, works more 1 version of jquery , works 1 particular version of jquery.
it responsibility of author of script uses jquery specify versions of jquery compatible with. responsibility of person using script know , understand version of jquery required , create proper environment (with right version of jquery present) script work properly.
a particular version of jqueryui compatible versions of core jquery. likewise, jqueryui plug-ins compatible versions of both jqueryui , jquery. must mix , match compatible versions of of these.
take @ example:
http://jquery.com/upgrade-guide/1.9/
also here overview of newer jquery 1.11 , 2.1.0
http://blog.jquery.com/2014/01/24/jquery-1-11-and-2-1-released/
javascript jquery audio
Comments
Post a Comment