Jump to content

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/173391-solved-php-and-onmouseover-problem/
Share on other sites

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)">

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

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];

}

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"

 

 

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

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'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 ... :o) I tried to make link to "popup" HTML page (emergency solution), but I'll be glad to make it to work this way. :-)

 

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.

 

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...  :D

 

 

Thanks a lot for your help and time  ;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.