Ok, have spent 3 days trying to figure this out.
What I want to do is more complex than this, such as passing PHP array values to a Javascript array, but I decided to first try do something simpler, and I just haven't managed.
So here is the code of this very short program, if anyone can help:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function showalert(what){
alert(what);
}
function showonscreen(){
document.write(val);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$myvar = 'Welcome to my web site';
echo '<script type="text/javascript" language="javascript">)';
echo "var val = '<?=$myvar?>'";
echo 'showalert(val)';
echo 'showonscreen()';
echo "showalert('this text')";
echo '</script>';
?>
</body>
</html>
None of the 3 function calls in the body part do what they are supposed to. Any ideas please?
😕