Click to See Complete Forum and Search --> : labels to div's


beretta
10-22-2003, 08:33 AM
I am trying to convert a webpage from N4 to IE5.5 changing document.labels to document.getElementById or document.all (both should work in IE 5.5) but I can't get a mouseover event to display in IE. I have also nested the labels tags in the div tags as IE does not support the Labels tag.

Here's how the code looks...

<html>
<head>
<body bgcolor="FFFFFF" text="000000">
</head>

<script>

function getpos(evt)
{
current=this;
current.mouseX=evt.pageX;
current.mouseY=evt.pageY;
}

var DHTML = (document.getElementById || document.all || document.layers);

function getObj(id)
{
if (document.getElementById)
{
this.obj = document.getElementById('id');
this.style = document.getElementById('id').style;
}
else if (document.all)
{
this.obj = document.all['id'];
this.style = document.all['id'].style;
}
else if (document.layers)
{
this.obj = document.layers['id'];
this.style = document.layers['id'];
}
}

function GetInfo()
{
if (!DHTML) return;
var x = new getObj('id');
x.style.src = "GetInfo.html";//my popup box should be displayed here but it does not in IE!!!
x.style.moveTo(this.mouseX+10,this.mouseY+10);
x.style.visibility = 'visible';
}

function HideInfo()
{
if (!DHTML) return;
var x = new getObj('id');
x.style.visibility = 'hidden';
}

window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=getpos

</script>

<body link= black >

<div id="layerA" left:0px; top:0px;>
<layer id=layerA left=0px top=0px>

//Then there is some php, here's a section of the code...

<script language="php">

echo " <tr>";echo "<th align=left><input type=checkbox value=$curDid name=OKS[] checked><a href = \"javascript:return(0)\" onmouseover=GetInfo() onmouseout=HideInfo()>$curDid</a> </th>\n";
}

?>

</layer>
</div>

//....and then the label and div tags right at the end...

<div id="id">
<layer id=id>
</layer>
</div>


I should get a 'GetInfo.html' popup when I mouseover the $curDid variable, but no matter what I do it is not displayed... any ideas?

Cheers

gil davis
10-22-2003, 01:44 PM
IE does not support SRC attribute for a DIV. I can think of two ways to get around this. 1) Use a Microsoft proprietary connection to load the file and then "move" it into the DIV using innerHTML, or 2) use a hidden IFRAME to load the file and then "move" it into the DIV using innerHTML.

The second method would be more compatible with current DOM compliant browsers (like IE 5, 6, and NS 6, 7).

beretta
10-23-2003, 10:45 AM
so would it look something like...

<div id="id">
<layer id=id left=0px top=0px visibility=hidden bgcolor=lightyellow>
<iframe id="frameid" name="framename" src="GetInfo.html" style="visibility:hidden;"></iframe>//the hidden frame to load the file
</layer>
</div>


function GetInfo()
{
if (!DHTML) return;
var x = new getObj('id');
x.innerhtml = document.frames['frameid'].document.body.innerhtml;
x.style.moveTo(this.mouseX+10,this.mouseY+10);
x.style.visibility = 'visible';
}


..this still does not work, how do you mean 'move' it into the div using innerhtml?

Thanks for the response.

beretta
10-27-2003, 06:19 AM
...any ideas....I am in a hole here and still digging...any more help would be appreciated.

gil davis
10-27-2003, 08:18 AM
Maybe this post will give you an idea of what I meant by "move it":

http://forums.webdeveloper.com/showthread.php?s=&threadid=20055

beretta
11-05-2003, 05:54 AM
Not sure how this will give me what I am after...although I am only a novice at this.

I was wanting to have a link that when initiated by the 'onmouseover' command, a information box would be displayed beside the cursor on this screen giving information to the link.

At the moment I am getting a frame at the bottom of the screen which loads the information and displays it inside..what I doing wrong?

gil davis
11-05-2003, 06:55 AM
Originally posted by beretta
At the moment I am getting a frame at the bottom of the screen which loads the information and displays it inside.That is what the example is supposed to do. It is a technique demonstration. Perhaps it is just over your head right now. You've got the file loaded into the page, now all you have to do is move the data where you want it. If you make the frame "visibility: hidden", no one will ever see it. It is just a container that loads the data you need.