jQuery签名不适用于IE< = 9 [英] JQuery Signature not working for IE <= 9
问题描述
我正在使用JQuery Singature,并且在上述IE版本中遇到此错误消息:
I am using JQuery Singature and I encountered this Error Message for above IE version:
Message: Canvas element does not support 2d context. jSignature cannot proceed.
update:在flashcanvas.js中添加(;)
update : After Added the (;) in the flashcanvas.js
问题是相同的:
消息:应为';'
flashcanvas.swf
Message: Expected ';'
flashcanvas.swf
Code: 0
我从以下位置下载了flashcanvas.swf
和flashcanvas.js
:
I have downloaded the flashcanvas.swf
and flashcanvas.js
from:
https://github.com/brinley/jSignature/blob/master/libs/flashcanvas.js https://github.com/brinley/jSignature/blob/master/libs/flashcanvas.swf
这两个文件我将它们放在一个名为Script的文件夹中.
these two files I placed them in a Folder called Script.
是否包含flashcanvas.swf没关系,我需要做什么?
It does not matter if I include or did not include flashcanvas.swf What I need to do?
此处是javascript
here the javascript
<!--[if lte IE 9]>
<script type="text/javascript" src="Script/flashcanvas.js"></script>
<script type="text/javascript" src="Script/flashcanvas.swf"></script>
<![endif]-->
<script type="text/javascript" src="Script/jSignature.js"></script>
<script type="text/javascript">
$(document).ready(function (){
$("#divSignature").jSignature({width:400, height:140, mousedown:function(){}});
});
</script>
推荐答案
只是语法错误,只需在flashcanvas.js的第928行更新以下内容即可:
Just a syntax error, simply update the following at line 928 of flashcanvas.js:
function getSwfUrl(window) {
return ( (window[FLASH_CANVAS + "Options"] || {})["swfPath"] || BASE_URL ) + "flashcanvas.swf"; //Added semicolon
}
IE往往对Javascript错误不太宽容,这对于学习该语言的程序员而言可能是一件好事.像Chrome这样的浏览器可以容纳很多JS错误,并且仍然可以正确执行脚本.
IE tend to be less lenient towards Javascript errors, which can be a good thing for programmers learning the language. Browsers like Chrome can accommodate a fair amount of JS errors and still correctly execute a script.
这篇关于jQuery签名不适用于IE< = 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!