Nick G
Nick G

Reputation: 1229

onnouseover not working in chrome, was working until update

I have the following function being called via onmouseover on an

    function showTooltip(tip, el, evt) {
    if (document.layers) {
        if (!el.tip) {
            el.tip = new Layer(200);
            el.tip.document.open();
            el.tip.document.write(tip);
            el.tip.document.close();
            el.onclick = function (evt) { this.tip.visibility = 'hide'; };
            el.onmouseout = function (evt) { this.tip.visibility = 'hide'; };
        }
        el.tip.left = evt.pageX;
        el.tip.top = evt.pageY;
        el.tip.visibility = 'show';
    }
    else if (document.all) {
        if (!el.tip) {
            document.body.insertAdjacentHTML('beforeEnd', '<DIV ID="tip' + tc + '" CLASS="tooltip">' + tip + '<\/DIV>');
            el.tip = document.all['tip' + tc++];
            el.onclick = function (evt) { this.tip.style.visibility = 'hidden'; };
            el.onmouseout = function (evt) { this.tip.style.visibility = 'hidden'; };
        }
        el.tip.style.pixelLeft = event.clientX + document.body.scrollLeft - 200
        el.tip.style.pixelTop = event.clientY + document.body.scrollTop + 10
        el.tip.style.visibility = 'visible';
    }
}

the call looks like;

<img id="ContentPlaceHolder1_DocumentList1_dg_imgNotes_0" onmouseover="javascript:showTooltip('<b>Pages:</b> 1<br><b>Date:</b> 8/7/2014<br><b>Rep ID:</b> 789',this,event);" src="/applications/Images/icons/no-a.bmp" align="absmiddle" style="border-width:0px;">

with the event of;

onmouseover="javascript:showTooltip('<b>Pages:</b> 1<br><b>Date:</b> 8/7/2014<br><b>Rep ID:</b> 789',this,event);"

this code has been working without a hitch for upwards of a year and still functions correctly in Firefox and IE, but not is Chrome Version 38.0.2125.111 m. I am no expert, but I feel like the declarations are all fine and the information being passed it alright, but when it hits the function it just steps over the if(document.layers) and the else if(document.all) when debugging, however, when in IE and debugging it steps into the else if statement just find and renders the tooltip for the exact same site.

any help would be appreciated.

Upvotes: 0

Views: 135

Answers (1)

brso05
brso05

Reputation: 13232

document.all and document.layers is obsolete. They are no longer supported by chrome.

Upvotes: 1

Related Questions