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.capture Events(Event.MO USEMOVE)\n";
echo "window.onmouse move=overhere\n ";
echo "topColor = \"#7D92A9\"\ n";
echo "subColor = \"#A5B4C4\"\ n";
echo "}\n";
echo "function MoveToolTip(lay erName, FromTop, FromLeft, e){\n";
echo "if(ie){eval(do c + layerName + sty + \".top = \" + (eval(FromTop) +
document.body.s crollTop))}\n";
echo "if(ns){eval(do c + 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){documen t.all[layerName].innerHTML = ContentInfo}\n" ;
echo "if(ns){\n" ;
echo "with(document. layers[layerName].document)\n";
echo "{\n";
echo " open();\n";
echo " write(ContentIn fo);\n";
echo " close();\n";
echo "}\n";
echo "}\n";
echo "}\n";
echo "function Activate(){init ialize=1}\n";
echo "function deActivate(){in itialize=0}\n";
echo "function overhere(e){\n" ;
echo "if(initialize) {\n";
echo "MoveToolTip(\" ToolTip\", Ey, Ex, e)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibilit y = 'visible'\")\n" ;
echo "}\n";
echo "else{\n";
echo "MoveToolTip(\" ToolTip\", 0, 0)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibilit y = 'hidden'\")\n";
echo "}\n";
echo "}\n";
echo "function EnterContent(la yerName, TTitle, TContent){\n";
echo "ContentInf o = '<table border=\"0\" width=\"150\" cellspacing=\"0 \"
cellpadding=\"0 \">'+\n";
echo "'<tr><td width=\"100%\" bgcolor=\"#0000 00\">'+\n";
echo "'<table border=\"0\" width=\"100%\" cellspacing=\"1 \"
cellpadding=\"0 \">'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+topCo lor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellspacing=\"0 \" cellpadding=\"0 \"
align=\"center\ ">'+\n";
echo "'<tr><td width=\"100%\"> '+\n";
echo "'<center>< font
class=\"tooltip title\"> ' +TTitle+'</font></center>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>'+\n";
echo "'</td></tr>'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+subCo lor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellpadding=\"0 \" cellspacing=\"1 \"
align=\"center\ ">'+\n";
echo "'<tr><td width=\"100%\"> '+\n";
echo "'<center>< font
class=\"tooltip content\">'+TCo ntent+'</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>";
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.capture Events(Event.MO USEMOVE)\n";
echo "window.onmouse move=overhere\n ";
echo "topColor = \"#7D92A9\"\ n";
echo "subColor = \"#A5B4C4\"\ n";
echo "}\n";
echo "function MoveToolTip(lay erName, FromTop, FromLeft, e){\n";
echo "if(ie){eval(do c + layerName + sty + \".top = \" + (eval(FromTop) +
document.body.s crollTop))}\n";
echo "if(ns){eval(do c + 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){documen t.all[layerName].innerHTML = ContentInfo}\n" ;
echo "if(ns){\n" ;
echo "with(document. layers[layerName].document)\n";
echo "{\n";
echo " open();\n";
echo " write(ContentIn fo);\n";
echo " close();\n";
echo "}\n";
echo "}\n";
echo "}\n";
echo "function Activate(){init ialize=1}\n";
echo "function deActivate(){in itialize=0}\n";
echo "function overhere(e){\n" ;
echo "if(initialize) {\n";
echo "MoveToolTip(\" ToolTip\", Ey, Ex, e)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibilit y = 'visible'\")\n" ;
echo "}\n";
echo "else{\n";
echo "MoveToolTip(\" ToolTip\", 0, 0)\n";
echo "eval(doc + \"ToolTip\" + sty + \".visibilit y = 'hidden'\")\n";
echo "}\n";
echo "}\n";
echo "function EnterContent(la yerName, TTitle, TContent){\n";
echo "ContentInf o = '<table border=\"0\" width=\"150\" cellspacing=\"0 \"
cellpadding=\"0 \">'+\n";
echo "'<tr><td width=\"100%\" bgcolor=\"#0000 00\">'+\n";
echo "'<table border=\"0\" width=\"100%\" cellspacing=\"1 \"
cellpadding=\"0 \">'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+topCo lor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellspacing=\"0 \" cellpadding=\"0 \"
align=\"center\ ">'+\n";
echo "'<tr><td width=\"100%\"> '+\n";
echo "'<center>< font
class=\"tooltip title\"> ' +TTitle+'</font></center>'+\n";
echo "'</td></tr>'+\n";
echo "'</table>'+\n";
echo "'</td></tr>'+\n";
echo "'<tr><td width=\"100%\" bgcolor='+subCo lor+'>'+\n";
echo "'<table border=\"0\" width=\"90%\" cellpadding=\"0 \" cellspacing=\"1 \"
align=\"center\ ">'+\n";
echo "'<tr><td width=\"100%\"> '+\n";
echo "'<center>< font
class=\"tooltip content\">'+TCo ntent+'</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>";
Comment