Saturday, 14 September 2013

Can't get right syntax for JavaScript variables inside php print

Can't get right syntax for JavaScript variables inside php print

What is wrong with the following code, that I produced for testing the
content of the button?
I get the syntax error "unexpected T_CONSTANT_ENCAPSED_STRING"
<?php /* Created on: 14-9-2013 */ ?>
<html>
<head>
<script type="text/javascript" charset="utf-8">
var mldkr = Math.round(screen.availWidth/2.08);
var supro = Math.round((screen.availHeight)/6), alto=supro*4
</script>
</head>
<body>
<table>
<?php
print '
<tr height="30">
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td align="right">
<button type="button" onclick="fenEspo = window.open(urlesp,
'', 'toolbar=0, location=0, directories=0, menuBar=0,
scrollbars=1, resizable=1, height='+alto+', top='+supro+',
left='+mldkr+', width='+mldkr, true)" title="Ne gravas, ne
kalkuli&#285;as por la statistiko.">Kaj kion donas Gugl
Trenslejt kiel<br />traduko(j)n por Esperanto?</button>
</td>
<td align="center">
<input type="radio" name="eo" value="1" />jes
<input type="radio" name="eo" value="0" />ne
<input type="radio" name="eo" value="-1" disabled="disabled"
/><font size="-3">ne aferkoncerna</font>
</td>
</tr>
'
?>
</table>
</body>
</html>
Thank you!

No comments:

Post a Comment