Happy_Alien Posted September 7, 2009 Share Posted September 7, 2009 Hi, I need a little help with this: OsCommerce + Created file PRICELIST, the content of PRICELIST is used in function DEFINE (php) - and this part seems doesn't work - error T_STRING - I'm not sure with syntax in ToolTip() function and quotes: <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,'<img src=map.png width=255 height=250 border=3 border=3>',420,20)"> Code: <?php define('NAVBAR_TITLE', 'aaa'); define('HEADING_TITLE', 'aaa'); define('TEXT_INFORMATION', ' <head> <script src="preview.js"></script> <style type="text/css"> .bold { font:900; } </style> </head> <body> <div id="Pop" style="position:absolute; margin-left: 200px; margin-top: 100"></div> <table> <tr> <td class="CATEGORY"> <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,'<img src=map.png width=255 height=250 border=3 border=3>',420,20)"> HM1303 - Makita</div></td> <td class="VALUE" width="10%">15 kg </td> <td class="VALUE" width="10%">120,-</td> <td class="VALUE" width="10%">600,-</td> <td class="VALUE" width="10%">20 000,- </td> </tr> </table> </html> '); ?> Thanks for any advice Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/ Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 Looks like the problem is here: <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,'<img src=map.png width=255 height=250 border=3 border=3>',420,20)"> You need to escape the apostrophes: <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,\'<img src=map.png width=255 height=250 border=3 border=3>\',420,20)"> Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914029 Share on other sites More sharing options...
Happy_Alien Posted September 7, 2009 Author Share Posted September 7, 2009 Looks like the problem is here: <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,'<img src=map.png width=255 height=250 border=3 border=3>',420,20)"> You need to escape the apostrophes: <div class="pop" onMouseOut="Hide();" style="width:100%;" onMouseOver="ToolTip(this,\'<img src=map.png width=255 height=250 border=3 border=3>\',420,20)"> I tried it in the morning ... it "works" - there is no error, but popop doesn't work. http://www.thtex-jh.cz/pricelist.php - line should show up the picture: like here: http://www.thtex-jh.cz/files/pricelist.html - 1st line is link as IMG - 2nd line is link as DIV Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914041 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 The div class="pop" isn't in the source code for that page, so it won't work... Stupid question perhaps, but after you've defined the constant, are you sure you are echoing it out where you want it to appear? Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914045 Share on other sites More sharing options...
Happy_Alien Posted September 7, 2009 Author Share Posted September 7, 2009 The div class="pop" isn't in the source code for that page, so it won't work... Stupid question perhaps, but after you've defined the constant, are you sure you are echoing it out where you want it to appear? Same code (except those \s) works fine in HTML ... there is something wrong with that DEFINE/slashes/quotes, or something ... probably. :-) Here is JS: var Obj; function ToolTip(obj,con,x,y){ Obj=document.getElementById('Pop'); Obj.innerHTML=con; Obj.style.left=(zxcPos(obj)[0]+x)+'px'; Obj.style.top=(zxcPos(obj)[1]+y)+'px'; Obj.style.visibility='visible'; } function Hide(){ Obj.style.visibility='hidden'; } function zxcPos(zxcobj){ zxclft=zxcobj.offsetLeft; zxctop=zxcobj.offsetTop; while(zxcobj.offsetParent!=null){ zxcpar=zxcobj.offsetParent; zxclft+=zxcpar.offsetLeft; zxctop+=zxcpar.offsetTop; zxcobj=zxcpar; } return [zxclft,zxctop]; } Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914057 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 JavaScript it not my strong suit unfortunately, but I believe it is case sensitive... So, line 3 should be: Obj=document.getElementById('pop'); and Lines 5 - 6 should be Obj.style.left=(zxcPos(Obj)[0]+x)+'px'; Obj.style.top=(zxcPos(Obj)[1]+y)+'px'; Also, getElementById is looking for an ID not a class, so possibly change your define() for your pop div so that it says <div id="pop" (etc... ) rather than <div class="pop" Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914060 Share on other sites More sharing options...
Happy_Alien Posted September 7, 2009 Author Share Posted September 7, 2009 JavaScript it not my strong suit unfortunately, but I believe it is case sensitive... So, line 3 should be: Obj=document.getElementById('pop'); and Lines 5 - 6 should be Obj.style.left=(zxcPos(Obj)[0]+x)+'px'; Obj.style.top=(zxcPos(Obj)[1]+y)+'px'; Also, getElementById is looking for an ID not a class, so possibly change your define() for your pop div so that it says <div id="pop" (etc... ) rather than <div class="pop" line 3, "pop" was already OK on my HDD line 5 and 6, changed "obj" --> "Obj" didn't work - in HTML neither class --> id ... it is working in HTML, but in that damned PHP still not I'm getting a little bit crazy of that :-D :-D :-D Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914063 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 I'll be honest with you, this one has me stumped. The page is rendering, so there is nothing wrong with the PHP... I still can't find the part of the source code on the link that you provided that relates to what you've defined in the PHP provided here though. Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914123 Share on other sites More sharing options...
Happy_Alien Posted September 7, 2009 Author Share Posted September 7, 2009 I'll be honest with you, this one has me stumped. The page is rendering, so there is nothing wrong with the PHP... I still can't find the part of the source code on the link that you provided that relates to what you've defined in the PHP provided here though. I'm trying to solve this problem since morning 1st file: http://www.thtex-jh.cz/files/pricelist.html -this one is HTML and it's working ... as an image, or whole name of that work tool (DIV) 2nd file: http://www.thtex-jh.cz/pricelist.php - is where I need put that function - content of that PHP is same like HTML above - but in function: <?php define('TEXT_INFORMATION', ' HTML CONTENT '); ?> 3rd file: http://www.thtex-jh.cz/files/preview.js Maybe is problem in that PHP with SCRIPT tag? Or try ECHO function? I really don't know even my name at the moment :-))) CSS, other things work ... but preview for that working tool doesn't ... ) I tried to make link to "popup" HTML page (emergency solution), but I'll be glad to make it to work this way. :-) Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914144 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 Ah, possibly see the problem. In file 2 (pricelist.php) in your define function, you are including the JS like this: <script src="preview.js"></script> But your last post says that it is in the directory files, so try changing this part of the define to <script src="files/preview.js"></script> and see if that works. Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914152 Share on other sites More sharing options...
Happy_Alien Posted September 8, 2009 Author Share Posted September 8, 2009 Ah, possibly see the problem. In file 2 (pricelist.php) in your define function, you are including the JS like this: <script src="preview.js"></script> But your last post says that it is in the directory files, so try changing this part of the define to <script src="files/preview.js"></script> and see if that works. As I wrote yesterday - it should be something, what I missed ... yes - it was this stupidity... Thanks a lot for your help and time Quote Link to comment https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/#findComment-914516 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.