Web Hosting Talk







View Full Version : mouseover popup


bambinou
11-14-2009, 06:06 PM
Hi,

I am new at programming and would like to know if you have a code I could add in my php page, I need a popup that shows on mouseover, if possible a pretty little popup that will show when the user will pass his mouse overt the question mark.


Many Thanks,


BamBam

AL-Kateb
11-15-2009, 05:33 AM
this is not done with php this is done with javascript

check this link
http://www.walterzorn.com/tooltip/tooltip_e.htm

you can search for "javascript onmouseover tooltip"

bambinou
11-15-2009, 08:06 AM
Perfect!

Thanks Al-Kated!


BamBam

bambinou
11-15-2009, 08:33 AM
Just one problem,

I cannot make it work,

I am trying to follow what they are saying here:
http://www.walterzorn.com/tooltip/tooltip_e.htm#extensions

but I have to add it in a PHP page ,here is the code:
<?php
$vat_country_list = ob_get_clean(); //end buffer and get its content

if ($vat_number) {

$country_code = substr($vat_number, 0, 2);
$vat_number = substr($vat_number, 2, strlen($vat_number));

$find_me = "value=\"$country_code\">";
$replace_me = "value=\"$country_code\" SELECTED>";

$vat_country_list = str_replace($find_me, $replace_me, $vat_country_list);
}

echo $vat_country_list;
echo "
</select>
</td>
</tr>
<tr><td colspan=\"2\" height=\"9\" class=\"onepx\">&nbsp;</td></tr>
<tr>
<td valign=top>".$lang['eartist']['vatnumber']."</td>
<td>
<input name=\"iso\" size=\"2\" maxlength=\"2\" readonly=\"true\" value=\"".(empty($country_code)? "---": $country_code)."\"/>
<input name=\"vat\" size=\"20\" maxlength=\"12\" value=\"".$vat_number."\"/>
<input type=\"button\" name=\"BtnSubmitVat\" value=\"".$lang['eartist']['btnverify']."\" onclick=\"checkFields(this.form)\"/>
</td>
</tr>
<tr><td colspan=\"2\" height=\"9\" class=\"onepx\">&nbsp;</td></tr>
<tr>
<td valign=top>VAT File</td>
<td><input type='file' name='vat_file' id='vat_file' />";
if($vat_file!='')
{
echo "&nbsp;&nbsp;<br><a href='".$path['webroot']."_files/ecommerce/artist/vatfile/".$vat_file."' target='_blank'>View Attached File</a>
|&nbsp;<a href='music.php?pageaction=edit&action=remove_vat_file' >Remove File</a>
";
}
echo "</td>
</tr>
</table>";

}
?>
--------------------------------------------
I need to add my "help" link right next to the :
<input type=\"button\" name=\"BtnSubmitVat\" value=\"".$lang['eartist']['btnverify']."\" onclick=\"checkFields(this.form)\"/>

I tried this but it did not work:
echo "<script language='javascript'>
<a href="index.htm" onmouseover="Tip('Some text')" onmouseout="UnTip()">Homepage </a></script>";



Any idea why?
I added the link in the body:
<script type="text/javascript" src="wz_tooltip.js"></script>


I followed the step by step but still nothing

AL-Kateb
11-15-2009, 11:49 AM
I tried this but it did not work:
echo "<script language='javascript'>
<a href="index.htm" onmouseover="Tip('Some text')" onmouseout="UnTip()">Homepage </a></script>";

u cant do it like that u are writing html inside javascript and u can do that with document.write if u wish but u dont need to do that here
u dont need to start script tag
u simply do it like that:

<a href="index.htm" onmouseover="Tip('Some text')" onmouseout="UnTip()">Homepage </a>

without the <script> tags and it will work

mattle
11-15-2009, 01:44 PM
I tried this but it did not work:
echo "<script language='javascript'>
<a href="index.htm" onmouseover="Tip('Some text')" onmouseout="UnTip()">Homepage </a></script>";



Any idea why?


In addition to AL-Kateb's advice about the <script> tags, you're also not escaping the double-quote characters in that string. I imagine you're getting parse errors here.

Also, I'd check out PHP's heredoc syntax (http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) for multi-line echo statements.