G
Gary Mayor
Hi,
I'm back again. Basically i'm trying to draw a box over an image which
is turning out to be a nightmare. The problem i'm getting at the moment
is that i'm creating a line with <div which works when it's not hidden
but I need to be able to make it hidden so I can use layers to show all
when it finished drawing to make it smoother. This is how some other
scripts are doing it that i've seen. So i've got it drawing a line and I
need getElementById to pick out the layer but it's only picking out NULL
with the one i've got enabled below. I've tried the others but they just
come out as errors. I need to get top2 which is the <div line to show
itself but I can't seem to reference it by getElementById. I use linux
mozilla so i need it working in mozilla as well as windows that's why
i'm using getElementById. My code is below any ideas anyone?
<html>
<head>
<script language="JavaScript" type="">
document.onmousedown = onmousedown;
var netscape = (document.layers) ? 1:0;
var goodIE = (document.all) ? 1:0;
var netscape6 = (document.getElementById && !document.all) ? 1:0;
var height = 100;
var width = 100;
var left = 50;
var top = 60;
var visible = false;
var name = 'secondtop';
str = '<div id="' + name +
'" style="position:absolute; overflow:none; left:' + left +
'px; top:' + top + 'px; width:' + width + 'px; height:' +
height +
'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +
'"><img name="left" src="/asdd/pixel.gif" border="1"></div>';
document.writeln(str);
var layer;
//layer = document.getElementById("' + name + '").style;
if(document.getElementById) {
//var show = document.getElementById;
//document.getElementById.(secondtop) = visible;
var name = 'top2'
//layer = eval('document.getElementById("' + name + '").style');
layer = document.getElementById("' + name + '");
//layer = eval('document.all.' + name + '.style');
//layer = document.layers[name];
alert("First" + layer);
}
else if(document.all) {
//return document.all[eN];
alert("Second");
}
else {
alert("Third");
//return null;
}
//layer.visibility = "visible";
layer.visibility = "show";
alert("hello");
function onmousedown(e)
{
document.writeln("hello");
}
</script>
</head>
<body bgcolor="FFFFFF">
<img border="1" src="iecadaptor.jpg">
<div id="top2" style="position:absolute; width:308px; height:1px;
z-index:1; left: 29px; top: 23px; overflow: visible; visibility: hidden;
background-color: black; layer-background-color: black; border: 1px none
#000000"></div>
</body>
</html>
Thanks
Gary
I'm back again. Basically i'm trying to draw a box over an image which
is turning out to be a nightmare. The problem i'm getting at the moment
is that i'm creating a line with <div which works when it's not hidden
but I need to be able to make it hidden so I can use layers to show all
when it finished drawing to make it smoother. This is how some other
scripts are doing it that i've seen. So i've got it drawing a line and I
need getElementById to pick out the layer but it's only picking out NULL
with the one i've got enabled below. I've tried the others but they just
come out as errors. I need to get top2 which is the <div line to show
itself but I can't seem to reference it by getElementById. I use linux
mozilla so i need it working in mozilla as well as windows that's why
i'm using getElementById. My code is below any ideas anyone?
<html>
<head>
<script language="JavaScript" type="">
document.onmousedown = onmousedown;
var netscape = (document.layers) ? 1:0;
var goodIE = (document.all) ? 1:0;
var netscape6 = (document.getElementById && !document.all) ? 1:0;
var height = 100;
var width = 100;
var left = 50;
var top = 60;
var visible = false;
var name = 'secondtop';
str = '<div id="' + name +
'" style="position:absolute; overflow:none; left:' + left +
'px; top:' + top + 'px; width:' + width + 'px; height:' +
height +
'px;' + ' visibility:' + (visible ? 'visible;' : 'hidden;') +
'"><img name="left" src="/asdd/pixel.gif" border="1"></div>';
document.writeln(str);
var layer;
//layer = document.getElementById("' + name + '").style;
if(document.getElementById) {
//var show = document.getElementById;
//document.getElementById.(secondtop) = visible;
var name = 'top2'
//layer = eval('document.getElementById("' + name + '").style');
layer = document.getElementById("' + name + '");
//layer = eval('document.all.' + name + '.style');
//layer = document.layers[name];
alert("First" + layer);
}
else if(document.all) {
//return document.all[eN];
alert("Second");
}
else {
alert("Third");
//return null;
}
//layer.visibility = "visible";
layer.visibility = "show";
alert("hello");
function onmousedown(e)
{
document.writeln("hello");
}
</script>
</head>
<body bgcolor="FFFFFF">
<img border="1" src="iecadaptor.jpg">
<div id="top2" style="position:absolute; width:308px; height:1px;
z-index:1; left: 29px; top: 23px; overflow: visible; visibility: hidden;
background-color: black; layer-background-color: black; border: 1px none
#000000"></div>
</body>
</html>
Thanks
Gary