Начал переделывать так как вы написали.
Контент загружается первый раз и выделяется, но не отсылает данные на сервер и при изменении размера ничего не происходит.. Может подскажете где зарыто?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>JFreeChart_Bsp</title>
<link rel="stylesheet" type="text/css" href="./extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="./jQuery/imgareaselect-0.9.8/css/imgareaselect-default.css"/>
<script type="text/javascript" src="./jQuery/jquery-1.7.2.js"></script>
<script type="text/javascript" src="./jQuery/imgareaselect-0.9.8/scripts/jquery.min.js"></script>
<script type="text/javascript" src="./jQuery/imgareaselect-0.9.8/scripts/jquery.imgareaselect.js"></script>
<script type="text/javascript" src="./extjs/ext-all-debug.js"></script>
</head>
<body>
<script type="text/javascript">
var random = Math.floor((Math.random() * 10000) + 1);
var cookie = "cookieName=" + random;
var adresse = "/JFreeeChartServlet/generateImg?" + cookie;
var cookieString = new String();
Ext.onReady(function() {
Ext.create("Ext.window.Window", {
height: 785,
width: 1465,
html: '<div id="generateImage"><img id="target"></div>',
listeners: {
afterrender: function(win, eOpts) {
this.getImg().addListener("load", function(e, img, eOpts) {
$("#target").one('load', loadCallback).attr('src', adresse).each(function () {
if (this.complete) $(this).trigger('load');
});
});
},
resize: function(win, width, height, eOpts ) {
this.getImg().set({ src: adresse });
}
},
getImg: function() {
if(!this.img)
this.img = Ext.get("target");
return this.img;
}
}).show();
$('#target').imgAreaSelect({
handles: true,
movable: false,
resizable: false,
autoHide: true,
onSelectEnd: function (img, selection) {
$("#target").one('load', loadCallback).attr("src", adresse + "&x1=" + selection.x1 + "&y1=" + selection.y1 + "&width=" + selection.width + "&height=" + selection.height).each(
function () {
if ($("#target").complete)
$("#target").trigger('load');
});
}
});
});
function loadCallback() {
cookieString = get_all_cookie(random)
// console.log("Cookie@"+random+" DocCookie = " + cookieString);
// console.log("Cookie@"+random+" : "+substr_search("plotWidth"));
// console.log("Cookie@"+random+" : "+substr_search("plotHeight"));
// console.log("Cookie@"+random+" : "+substr_search("plotX"));
// console.log("Cookie@"+random+" : "+substr_search("plotY"));
setVars(substr_search("plotWidth"), substr_search("plotHeight"), substr_search("plotX"),substr_search("plotY"));
}
function get_all_cookie(cookie_name) {
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results) return (unescape(results[2]));
else return null;
}
function substr_search(str){
var strStartPos = cookieString.search(str);
var startPos = cookieString.indexOf("=", strStartPos);
var endPos = cookieString.indexOf(":", strStartPos);
return cookieString.substring(startPos+1, endPos);
}
</script>
</body>
</html>
Спасибо!