im not too good with javascript,
im using jcrop cropping tool, i made some changes to the script which seem to be fine with firefox, but it doesnt work in Internet explorer,
can someone identify if i have any syntax problems in this code,
thanks
link to the page,
http://www.yourwallart.co.uk/croppin...pping/baby.jpg
in firefox, the cropping box appears, but in IE it doesnt
Note: Cute, But Not my BABY!
Code:
<script src="/js/jquery.pack.js"></script>
<script src="/js/jquery.Jcrop.pack.js"></script>
<link rel="stylesheet" href="/css/jquery.Jcrop.css" type="text/css" />
<script language="Javascript">
$(window).load(function(){
var api = $.Jcrop('#cropbox',{
setSelect: [ 0, 0, 200000, 200000 ],
onSelect: updateCoords,
onChange: updateCoords,
<?php
if($_GET['size'] == 200200){
echo 'aspectRatio: 1';
}
?>
<?php
if($_GET['size'] == 300400){
echo 'aspectRatio: 3 / 4';
}
?>
<?php
if($_GET['size'] == 400300){
echo 'aspectRatio: 4 / 3';
}
?>
<?php
if($_GET['size'] == 500500){
echo 'aspectRatio: 1';
}
?>
<?php
if($_GET['size'] == 8001000){
echo 'aspectRatio: 4 / 5';
}
?>
<?php
if($_GET['size'] == 1000800){
echo 'aspectRatio: 5 / 4';
}
?>
});
var i, ac;
// A handler to kill the action
function nothing(e)
{
e.stopPropagation();
e.preventDefault();
return false;
};
// Returns event handler for animation callback
function anim_handler(ac)
{
return function(e) {
api.animateTo(ac);
return nothing(e);
};
};
// Setup some coordinates for animation
var ac =
{
anim1: [0,0,200,20000] ,
anim2: [0,0,150,200],
anim3: [0,0,200,200],
anim4: [0,0,160,200],
anim5: [80,160,500,190],
};
// Attach respective event handlers
for(i in ac) jQuery('#'+i).click(anim_handler(ac[i]));
// Attach another one manually, to demonstrate "set" w/o animation
jQuery('#setsel').click(function(e) {
api.setSelect( [ 200, 200, 300, 300 ] );
return nothing(e);
});
$(function(){
$('#cropbox').Jcrop({
aspectRatio: 1,
onSelect: updateCoords
});
});
function updateCoords(c)
{
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
};
function checkCoords()
{
if (parseInt($('#x').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};
});
</script>