ciao a tutti,
ho questo script che non funziona su mozilla, qualcuno mi può aiutare?..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://www.br1w.com/htmlit/rettangolo/index.htm -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT>
document.onselectstart = new Function("return true;");
document.ondragstart = new Function("return false;");
r_on = false;
x0=0;
y0=0;
x1=0;
y1=0;
iw=0;
ih=0;
il=0;
it=0;
bordo=1 *2;
function getPageCoords(element) {
// thanks to 'Martin Honnen' for this function
var coords = {x: 0, y: 0};
while (element) {
coords.x += element.offsetLeft;
coords.y += element.offsetTop;
element = element.offsetParent;
}
return coords;
}
function getMouseCoords(e) {
if(!e) e = window.event;
var coords = {x: 0, y: 0};
coords.x = e.x -1;
coords.y = e.y -1;
if(navigator.appName == "Netscape") {
coords.x += window.pageXOffset;
coords.y += window.pageYOffset;
}
if (navigator.appVersion.indexOf("MSIE") != -1){
if (navigator.appVersion.indexOf("Mac") == -1){
coords.x += document.body.scrollLeft;
coords.y += document.body.scrollTop;
}
}
return coords
}
function r_misura(obj) {
iw = obj.width;
ih = obj.height
p = getPageCoords(obj);
il = p.x;
it = p.y;
obj.alt='t='+it+' l='+il+' w='+iw+' h='+ih
}
function r_start(obj) {
p = getMouseCoords();
x0 = p.x -1;
y0 = p.y -1;
x1 = x0;
y1 = y0;
r_on = true;
d = document.re1.style;
d.top=y0;
d.left=x0;
d.height=0;
d.width=0;
d.display='none';
}
function r_move(obj) {
if (r_on) {
p = getMouseCoords()
x1 = p.x;
y1 = p.y;
// x1 = (x1<x0)?x1-1:x1;
// y1 = (y1<y0)?y1-1:y1;
d = document.re1.style;
// riordino e correggo le coordinate per l'immagine
ix0 = (x1<x0)?x1-1:x0;
iy0 = (y1<y0)?y1-1:y0;
ix1 = (x1>x0)?x1:x0;
iy1 = (y1>y0)?y1:y0;
// limito l'escursione
ix0 = (ix0<il)?il:ix0;
iy0 = (iy0<it)?it:iy0;
ix1 = (ix1>iw+il)?iw+il:ix1;
iy1 = (iy1>ih+it)?ih+it:iy1;
if (ix1-ix0>bordo && iy1-iy0>bordo) {
d.display=''
d.top=iy0;
d.left=ix0;
d.width=ix1-ix0-bordo;
d.height=iy1-iy0-bordo;
} else {
d.display='none'
}
f = document.misure;
f.myTop.value=y0-it;
f.myLeft.value=x0-il;
f.myBottom.value=y1-it;
f.myRight.value=x1-il;
f.myHeight.value=y1-y0;
f.myWidth.value=x1-x0;
}
}
function r_stop() {
r_on = false;
}
</SCRIPT>
<META content="MSHTML 5.50.4134.100" name=GENERATOR></HEAD>
<BODY bgColor=cyan><IMG onmouseup=r_stop(this) onmousemove=r_move(this)
onmousedown=r_start(this) src="index_file/image2.jpg" onload=r_misura(this)>
<IMG
style="BORDER-RIGHT: black 1px dotted; BORDER-TOP: black 1px dotted; DISPLAY: none; LEFT: 0px; BORDER-LEFT: black 1px dotted; BORDER-BOTTOM: black 1px dotted; POSITION: absolute; TOP: 0px"
src="index_file/ghost.gif" name=re1
NOonload="bordo=parseFloat(this.style.border)">
<HR>
<FORM name=misure>Top:<INPUT size=3 name=myTop> Left:<INPUT size=3 name=myLeft>
Bottom:<INPUT size=3 name=myBottom> Right:<INPUT size=3 name=myRight>
Height:<INPUT size=3 name=myHeight> Width:<INPUT size=3 name=myWidth> <INPUT onclick="x0=0;y0=0;document.re1.style.display='none'" type=reset value=Clear>
</FORM></BODY></HTML>
grazie mille
Doppio
ho questo script che non funziona su mozilla, qualcuno mi può aiutare?..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://www.br1w.com/htmlit/rettangolo/index.htm -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT>
document.onselectstart = new Function("return true;");
document.ondragstart = new Function("return false;");
r_on = false;
x0=0;
y0=0;
x1=0;
y1=0;
iw=0;
ih=0;
il=0;
it=0;
bordo=1 *2;
function getPageCoords(element) {
// thanks to 'Martin Honnen' for this function
var coords = {x: 0, y: 0};
while (element) {
coords.x += element.offsetLeft;
coords.y += element.offsetTop;
element = element.offsetParent;
}
return coords;
}
function getMouseCoords(e) {
if(!e) e = window.event;
var coords = {x: 0, y: 0};
coords.x = e.x -1;
coords.y = e.y -1;
if(navigator.appName == "Netscape") {
coords.x += window.pageXOffset;
coords.y += window.pageYOffset;
}
if (navigator.appVersion.indexOf("MSIE") != -1){
if (navigator.appVersion.indexOf("Mac") == -1){
coords.x += document.body.scrollLeft;
coords.y += document.body.scrollTop;
}
}
return coords
}
function r_misura(obj) {
iw = obj.width;
ih = obj.height
p = getPageCoords(obj);
il = p.x;
it = p.y;
obj.alt='t='+it+' l='+il+' w='+iw+' h='+ih
}
function r_start(obj) {
p = getMouseCoords();
x0 = p.x -1;
y0 = p.y -1;
x1 = x0;
y1 = y0;
r_on = true;
d = document.re1.style;
d.top=y0;
d.left=x0;
d.height=0;
d.width=0;
d.display='none';
}
function r_move(obj) {
if (r_on) {
p = getMouseCoords()
x1 = p.x;
y1 = p.y;
// x1 = (x1<x0)?x1-1:x1;
// y1 = (y1<y0)?y1-1:y1;
d = document.re1.style;
// riordino e correggo le coordinate per l'immagine
ix0 = (x1<x0)?x1-1:x0;
iy0 = (y1<y0)?y1-1:y0;
ix1 = (x1>x0)?x1:x0;
iy1 = (y1>y0)?y1:y0;
// limito l'escursione
ix0 = (ix0<il)?il:ix0;
iy0 = (iy0<it)?it:iy0;
ix1 = (ix1>iw+il)?iw+il:ix1;
iy1 = (iy1>ih+it)?ih+it:iy1;
if (ix1-ix0>bordo && iy1-iy0>bordo) {
d.display=''
d.top=iy0;
d.left=ix0;
d.width=ix1-ix0-bordo;
d.height=iy1-iy0-bordo;
} else {
d.display='none'
}
f = document.misure;
f.myTop.value=y0-it;
f.myLeft.value=x0-il;
f.myBottom.value=y1-it;
f.myRight.value=x1-il;
f.myHeight.value=y1-y0;
f.myWidth.value=x1-x0;
}
}
function r_stop() {
r_on = false;
}
</SCRIPT>
<META content="MSHTML 5.50.4134.100" name=GENERATOR></HEAD>
<BODY bgColor=cyan><IMG onmouseup=r_stop(this) onmousemove=r_move(this)
onmousedown=r_start(this) src="index_file/image2.jpg" onload=r_misura(this)>
<IMG
style="BORDER-RIGHT: black 1px dotted; BORDER-TOP: black 1px dotted; DISPLAY: none; LEFT: 0px; BORDER-LEFT: black 1px dotted; BORDER-BOTTOM: black 1px dotted; POSITION: absolute; TOP: 0px"
src="index_file/ghost.gif" name=re1
NOonload="bordo=parseFloat(this.style.border)">
<HR>
<FORM name=misure>Top:<INPUT size=3 name=myTop> Left:<INPUT size=3 name=myLeft>
Bottom:<INPUT size=3 name=myBottom> Right:<INPUT size=3 name=myRight>
Height:<INPUT size=3 name=myHeight> Width:<INPUT size=3 name=myWidth> <INPUT onclick="x0=0;y0=0;document.re1.style.display='none'" type=reset value=Clear>
</FORM></BODY></HTML>
grazie mille
Doppio