That's neither valid PHP nor valid javascript code. If it's PHP, where are the echo directives you mentioned?
It looks to me to be more like javascript. If so, here's what you might do:
Code:
<script type="text/javascript">
var windowtitle = document.getElementById('<?php echo $username .'id'; ?>').innerHTML; // this variable works
var online = "<a href=\"javascript:void(0);\" onclick=\"parent.dhtmlwindow.open('<?php echo $username . 'box'; ?>', 'div', '<?php echo $profemail2; ?>', '" + windowtitle + "', width=224px,height=227px,left=200px,top=150px,resize=0,scrolling=0,center=1); return false"><font style=\"padding-left:0px; width:100%; background-color:transparent;color:#000000; font-size:11px; text-decoration:none; text-align:left\">CHAT ONLINE</font></a>";
</script>
Whatever you do, if there's a problem, load up the page in the browser. Use the browser's 'view source' to see how the PHP tokens are being resolved. You should then be able to edit the code so that it produces the desired result in the source view, which of course should conform to that required by the javascript. This is no different than any javascript which is written in whole or in part by PHP.
Bookmarks