PHP and Javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

PHP and Javascript

Post by quadoc »

I'm passing a Php's text variable to a javascript to display in the tooltips. I can't get javascript to insert the LF or CR when displaying the text. Could someone tell me what I'm missing. Please see script below. Thanks...
:?

Code: Select all

<?php

$tixLevdesc =  "Severity 1 - Response in  1 business hour, Resolution in 4 business hours. <br>";
$tixLevdesc .= "Severity 2 - Response in  8 business hours, Resolution in 1 business day. <br> ";
$tixLevdesc .= "Severity 3 - Response in 12 business hours, Resolution in 3 business days. <br>";
$tixLevdesc .= "Severity 4 - Response in 24 business hours, Resolution in 5 business days. <br>";
$tixsubject = "This is a test";
?> 
<script language="javascript">
function showtip(current,e,text)
{
if (document.all)
   {
	thetitle=text.split('<br>')
	if (thetitle.length>1)
	   {
		thetitles=''
		for (i=0;i<thetitle.length;i++)
			thetitles+=thetitle[i]
		current.title=thetitles
		}
	else
		current.title=text
	}
else if (document.layers)
   {	
    document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
    document.tooltip.document.close()
    document.tooltip.left=e.pageX+15
    document.tooltip.top=e.pageY+15
    document.tooltip.visibility="show"
   }
}
function hidetip()
{
if (document.layers)
document.tooltip.visibility="hidden"
}
</script>

<table border = 1><tr>

<td>
<b><a href="<?echo "";?>" class="link" onMouseover="showtip(this,event,'<?=$tixLevdesc?>')" onMouseout="hidetip()"><?=substr($tixsubject,0,30)?></b></a>
  
</td>
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

The LF or CR...?

Whats up with this: <?echo "";?>
Post Reply