|
-
Feb 2nd, 2007, 04:00 AM
#1
Thread Starter
Hyperactive Member
Tooltip javascript ASP.NET
Hi all,
I've got the below javascript function. What it does: on an ASP.NET form, I register this script as a client startupscript. In the attributes of the controls, I add a mouseover event to fire the javascript, which shows a tooltip. That's what the javascript does. However, I want this code to determine the number of rows in the variable msg, and count the height of the e_div variable according to the number of rows in msg. Does anyone know how to do that? See red lines where I think it should be done.
Code:
js = "<script language=""javascript"">"
js &= "function showToolTip(evt,msg)"
js &= "{"
js &= "var ifr = document.frames(""ifr"").document; "
js &= "var e_html = ifr.createElement(""html""); "
js &= "var e_body = ifr.createElement(""body"");"
js &= "e_body.style.marginLeft = ""0px""; "
js &= "e_body.style.marginTop = ""0px""; "
js &= "e_body.style.marginBottom = ""0px"";"
js &= "e_body.style.marginRight = ""0px""; "
js &= "var e_div = ifr.createElement(""div"");"
js &= "e_div.id = ""divContent""; "
js &= "e_div.style.wordWrap=""break-word""; "
js &= "e_div.style.backgroundColor=""#aad5ff"";"
js &= "e_div.style.borderStyle=""solid""; "
js &= "e_div.style.borderWidth=""1px""; "
js &= "e_div.style.borderColor=""#336699""; "
js &= "e_div.style.paddingLeft = ""3px""; "
js &= "e_div.style.paddingTop = ""3px""; "
js &= "e_div.style.paddingBottom = ""3px""; "
js &= "e_div.style.paddingRight = ""3px""; "
js &= "e_div.innerHTML = msg; "
'custom
js &= "e_div.style.height = ""500px""; "
'js &= "ifr.height = e_div.style.height; "
'end custom
js &= "e_body.appendChild(e_div); "
js &= "e_html.appendChild(e_body); "
js &= "ifr.appendChild(e_html); "
js &= "var oBody = document.frames(""ifr"").document.getElementById(""divContent""); "
js &= "var oFrame = document.all(""ifr""); "
js &= "var oFrDiv = document.all(""frDiv""); "
js &= "oFrame.style.height = oBody.offsetHeight; "
js &= "oFrDiv.style.visibility=""visible""; "
js &= "oFrDiv.style.left = (evt.x + 10) + ""px"";"
js &= "oFrDiv.style.top = (evt.y + 10) + ""px""; "
js &= "oFrDiv.style.height = oFrame.style.height;"
js &= "}"
js &= "</script>"
Thanx in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|