Page 1 of 1

PHP and Javascript

Posted: Mon Oct 24, 2005 1:27 pm
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>

Posted: Mon Oct 24, 2005 3:51 pm
by hawleyjr
The LF or CR...?

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