All,
I've been creating a kind of mouse over tool tip which uses javascript to position a DIV near the mouse and used div.innerHTML to display the appropriate text.
Problem is that I would like to keep the theme of the rest of the site which involves a background image to this (previously static) 'floating' div. The DIV is resized to accomodate the amount of text intended for it, problem is dynamically resizing the background image . . which currently tiles for large amounts of text... anyway, here's the snippet.. any help appreciated.
stuart
function floatDIV(x, y)
{
document.all.display.style.left = x + 75;
document.all.display.style.top = y;
document.all.display.style.visibility ='visible';
}
function ieCoords() {
var xpos = event.clientX;
var ypos = event.clientY;
var width = document.all.display.innerHTML.length*2;
var height = document.all.display.innerHTML.length
//status = "x: "+ xpos +" y: " +ypos;
setDiv(width, height); //another function ...
divBackground = new Image();
divBackground.src = 'images/divbackground1.gif';
divBackground.width = width;
divBackground.height = height;
display.style.backgroundImage='url'+divBackground.src+')';
floatDIV(xpos, ypos);
}
I see why this doesn't work ... I just don't know how else to call the backgroundImage but give it a different size.!
I've been creating a kind of mouse over tool tip which uses javascript to position a DIV near the mouse and used div.innerHTML to display the appropriate text.
Problem is that I would like to keep the theme of the rest of the site which involves a background image to this (previously static) 'floating' div. The DIV is resized to accomodate the amount of text intended for it, problem is dynamically resizing the background image . . which currently tiles for large amounts of text... anyway, here's the snippet.. any help appreciated.
stuart
function floatDIV(x, y)
{
document.all.display.style.left = x + 75;
document.all.display.style.top = y;
document.all.display.style.visibility ='visible';
}
function ieCoords() {
var xpos = event.clientX;
var ypos = event.clientY;
var width = document.all.display.innerHTML.length*2;
var height = document.all.display.innerHTML.length
//status = "x: "+ xpos +" y: " +ypos;
setDiv(width, height); //another function ...
divBackground = new Image();
divBackground.src = 'images/divbackground1.gif';
divBackground.width = width;
divBackground.height = height;
display.style.backgroundImage='url'+divBackground.src+')';
floatDIV(xpos, ypos);
}
I see why this doesn't work ... I just don't know how else to call the backgroundImage but give it a different size.!