<?php
$lines = file ($filename);
$contents="";
foreach ($lines as $line_num => $line) {
$contents=$contents.$line;
}
$line=str_replace ("\r\n","",$contents);
$contents=htmlspecialchars($contents);
?>
<HTML>
<HEAD>
</HEAD>
<BODY>
<Table id="test" border=0;>
<tr><td>ok i am here
</td></tr>
</Table>
<a href="#" onClick="change('<?=$contents?>');">click here</a>
</BODY>
</HTML>
<script language="Javascript">
function change(check)
{
alert(check);
var myref = getRefToDiv('test');
myref.tBodies[0].rows[0].cells[0].innerHTML = check;
}
function getRefToDiv(divID) {
//if( document.layers ) { return document.layers[divID]; }
if( document.layers ) { return document.layers[divID]; }
if( document.getElementById ) { return document.getElementById(divID); }
if( document.all ) { return document.all[divID]; }
if( document[divID+'C'] ) { return document[divID+'C'].document[divID]; }
return false;
}
</script>
on passing the file content to the javascript it gives a "unterminated string constant error". but when i copy the content of the file and paste it to another file. and test with the new file. it works fine.
plzzzzzzzzz help ..........................