homepage Welcome to WebmasterWorld Guest from 54.81.170.186
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Tool Tip script problem
Script was going, now isn't after validation
Sypher_5




msg:1482485
 7:01 pm on Dec 16, 2003 (gmt 0)

I have to have this in my pages in order for the tool tip script to work.

<body onmousemove='overhere()'>

The tool tip script is external ( due to using XHTML ), & looks like this.

var ie = document.all? 1 : 0
var ns = document.layers? 1 : 0
if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}
var initialize = 0
var Ex, Ey, topColor, subColor, ContentInfo
if(ie){
Ex = "event.x"
Ey = "event.y"
topColor = "#663366"
subColor = "#ffbb00"
}
if(ns){
Ex = "e.pageX"
Ey = "e.pageY"
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=overhere
topColor = "#663366"
subColor = "#ffbb00"
}
function MoveToolTip(layerName, FromTop, FromLeft, e){
if(ie){eval(doc + layerName + sty + ".top = " + (eval(FromTop) + document.body.scrollTop))}
if(ns){eval(doc + layerName + sty + ".top = " + eval(FromTop))}
eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 10))
eval(doc + layerName + sty + ".top = " + (eval(FromTop) + 10))
}
function ReplaceContent(layerName){
if(ie){document.all[layerName].innerHTML = ContentInfo}
if(ns){
with(document.layers[layerName].document)
{
open();
write(ContentInfo);
close();
}
}
}
function Activate(){initialize=1}
function deActivate(){initialize=0}
function overhere(e){
if(initialize){
MoveToolTip("ToolTip", Ey, Ex, e)
eval(doc + "ToolTip" + sty + ".visibility = 'visible'")
}
else{
MoveToolTip("ToolTip", 0, 0)
eval(doc + "ToolTip" + sty + ".visibility = 'hidden'")
}
}
function EnterContent(layerName, TTitle, TContent){

ContentInfo = '<div class=balloont>'+TTitle+'</div>'+
'<div class=balloonb>'+TContent+'</div>';
ReplaceContent(layerName)
}

To have it appear over an object you add this to it.

onmouseover="EnterContent('ToolTip','Name','Content'); Activate();" onMouseout="deActivate()"

At the moment I'm getting an error & the tool tip isn't appearing. Not only that you cant drag select any of the page, text or images etc. This has been since cleaning up the php and the XHTML, I didn't stop to check what was causing it till after I passed the XHTML & CSS validations.

If I remove the body section of the script from the page the error goes away, but so does my ability to use the tool tip.

What's broken?

There's also a popup script running exeternally FYI.

 

HocusPocus




msg:1482486
 3:19 am on Dec 17, 2003 (gmt 0)

Just tested, seemed ok. The only line I added was

<DIV id=ToolTip style="position:absolute"></DIV>

Hope this helps

-M

Sypher_5




msg:1482487
 10:21 am on Dec 17, 2003 (gmt 0)

Doh, that's in there but I forgot to quote it. However its style is in the external CSS.

<div id='ToolTip'></div>

Is in the page after the nav, before the content.

#ToolTip {
position : absolute;
top : 0;
left : 0;
z-index : 4;
visibility : hidden;
}

In the External CSS.

Sypher_5




msg:1482488
 10:28 am on Dec 17, 2003 (gmt 0)

Haha I just figured it out when I went to check I'd included the script correctly.

As part of validating my page as XHTML I was told to add a "type". Somehow I added:

type='text/css'

Which should've been,

type='text/javascript'

Thanks for the help.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved