<?
$strBeg= file_get_contents($_SERVER['DOCUMENT_ROOT']."/begin.php");
$strEnd= file_get_contents($_SERVER['DOCUMENT_ROOT']."/end.php");
?>
<script language="JavaScript">
var beg= '<?=$strBeg?>';
var end= '<?=$strEnd?>';
function showIm(im)
{
alert('');
document.write(beg);
document.write(im);
document.write(end);
}
</script>
Why can't I write the document at runtime with javascript? showIm is called on a mouseclick event.
This does not work either:
<script language="JavaScript">
alert('');
var beg= '<?=file_get_contents($SERVER['DOCUMENT_ROOT']."/begin.php");?>';
var end= '<?=file_get_contents($SERVER['DOCUMENT_ROOT']."/end.php");?>';
function showIm(im)
{
document.write(beg);
document.write(im);
document.write(end);
}
</script>
I don't even see the alert box when the page opens, it says there are errros on the page.