は私のコードです:問題
$('#add_shape').click(function() {
var rectHeight = $('#rect_height_input').val();
var WidthOrRadius = $('#widthorradius').val();
$('<canvas>').attr({
id:'canvas'
}).css({
height:function() {
if (rectHeight > 0) {
return rectHeight + 'px';
}
else {
return WidthOrRadius + 'px';
}
},
width:WidthOrRadius + 'px'
})
.appendTo('#work_area');
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = $('#color_list option:selected').val();
ctx.fillRect(0, 0 , WidthOrRadius, rectHeight);
});
このコードはjsfiddle上で動作します(ここでは:http://jsfiddle.net/dzejkej/xwg5f/)私のブラウザではありません。何が間違っているのか分かりません。誰か助けてもらえますか?
どのブラウザですか? – czarchaic
@ czarchaic - firefox最新バージョン – dopatraman