Hello all.
Can someone help out ? I found this PHP code that works just fine, however,
I am trying to put it back into its original Javascript form.
I am still learning the syntax, etc. for Javascript, so I'm not really sure
what needs
to be removed and kept.
I was trying the basic search/replaces, but always ended up with Javascript
errors.
Here is the code:
Ultimately, all it does it allow me to create a "tooltip" box which I use to
float over
images (i.e. copyright information and such). Eventually, I would like to
completely
replace the JS code with either some fancy CSS or something else (since more
and
more I read I see about trying to cut back on JS code)
echo "<script language = \"javascript\">\n";
echo "<!--\n";
echo "var ie = document.all ? 1 : 0\n";
echo "var ns = document.layers ? 1 : 0\n";
echo "if(ns){doc = \"document.\"; sty = \"\"}\n";
echo "if(ie){doc = \"document.all.\"; sty = \".style\"}\n";
echo "var initialize = 0\n";
echo "var Ex, Ey, topColor, subColor, ContentInfo\n";
echo "if(ie){\n";
echo "Ex = \"event.x\"\n";
echo "Ey = \"event.y\"\n";
echo "topColor = \"#7D92A9\"\n";
echo "subColor = \"#A5B4C4\"\n";
echo "}\n";
echo "if(ns){\n";
echo "Ex = \"e.pageX\"\n";
echo "Ey = \"e.pageY\"\n";
echo "window.captureEvents(Event.MOUSEMOVE)\n";
echo "window.onmousemove=overhere\n";
echo "topColor = \"#7D92A9\"\n";
echo "subColor = \"#A5B4C4\"\n";
echo "}\n";
echo "function MoveToolTip(layerName, FromTop, FromLeft, e){\n";
echo "if(ie){eval(doc + layerName + sty + \".top = \" + (eval(FromTop) +
document.body.scrollTop))}\n";
echo "if(ns){eval(doc + layerName + sty + \".top = \" +
eval(FromTop))}\n";
echo "eval(doc + layerName + sty + \".left = \" + (eval(FromLeft) + 15))\n";
echo "}\n";
echo "function ReplaceContent(layerName){\n";
echo "if(ie){document.all[layerName].innerHTML = ContentInfo}\n";
echo "if(ns){\n";
echo "with(document.layers[layerName].document)\n";
echo "{\n";
echo " open();\n";
echo " write(ContentInfo);\n";
echo " close();\n";
echo "}\n";
echo "}\n";
echo "}\n";
echo "function Activate(){initialize=1}\n";
echo "function deActivate(){initialize=0}\n";
echo "function overhere(e){\n";
echo "if(initialize){\n";
echo "MoveToolTip(\"ToolTip\", Ey, Ex, e)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibility = 'visible'\")\n";
echo "}\n";
echo "else{\n";
echo "MoveToolTip(\"ToolTip\", 0, 0)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibility = 'hidden'\")\n";
echo "}\n";
echo "}\n";
echo "function EnterContent(layerName, TTitle, TContent){\n";
echo "ContentInfo = '<table border=\"0\" width=\"150\" cellspacing=\"0\"
cellpadding=\"0\">'+\n";
echo "'<tr><td width=\"100%\" bgcolor=\"#000000\">'+\n";
echo "'<table border=\"0\" width=\"100%\" cellspacing=\"1\"
cellpadding=\"0\">'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+topColor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellspacing=\"0\" cellpadding=\"0\"
align=\"center\">'+\n";
echo "'<tr><td width=\"100%\">'+\n";
echo "'<center><font
class=\"tooltiptitle\"> '+TTitle+'</font></center>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>'+\n";
echo "'</td></tr>'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+subColor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellpadding=\"0\" cellspacing=\"1\"
align=\"center\">'+\n";
echo "'<tr><td width=\"100%\">'+\n";
echo "'<center><font
class=\"tooltipcontent\">'+TContent+'</font></center>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>';\n";
echo "ReplaceContent(layerName)\n";
echo "}\n";
echo "//-->\n";
echo "</script>";