antonyfal Posted January 15, 2012 Share Posted January 15, 2012 Hi. How can i write this?. I have a page in a iframe it gets the contents of div from parent page, and outputs it to the title of a window script. I cant get to output the javascript var it only shows as +windowtitle+ . here is my code: (The problem is with window title it outputs as +windowtitle+ ) <script type="text/javascript"> var windowtitle = document.getElementById(\''.$username.'id\').innerHTML; // i also used plain text to test this but still get +windowtitle+ var url_destination = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var url_ajax = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var online = "<a href=\"javascript:void(0);\" onclick=\"parent.dhtmlwindow.open(\''.$username.'box\', \'div\', \''.$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>"; var offline = \'<span style=\"padding-left:0px; width:100%; background-color:transparent; color:#ff0033; font-size:11px; text-decoration:none; text-align:left\">CHAT OFFLINE</span>\'; document.write(\'<\' + \'script type="text/javascript" src="http://'.$host.'/chat/'.$username.'/'.$profemail2.'/chat2.js"></\' + \'script>\'); </script> Quote Link to comment https://forums.phpfreaks.com/topic/255053-how-to-output-java-var-in-html-on-php-page/ Share on other sites More sharing options...
trq Posted January 15, 2012 Share Posted January 15, 2012 Java is not JavaScript. You have also posted your code in the manual [m][/m] tags making it unreadable. Quote Link to comment https://forums.phpfreaks.com/topic/255053-how-to-output-java-var-in-html-on-php-page/#findComment-1307818 Share on other sites More sharing options...
antonyfal Posted January 15, 2012 Author Share Posted January 15, 2012 Sorry for that nicely pointed out about the java/javascript here is my code again: (the [m][/m] tags have the php symbol on them so honest mistake there) <script type="text/javascript"> var windowtitle = document.getElementById(\''.$username.'id\').innerHTML; // i also used plain text to test this but still get +windowtitle+var url_destination = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var url_ajax = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var online = "<a href=\"javascript:void(0);\" onclick=\"parent.dhtmlwindow.open(\''.$username.'box\', \'div\', \''.$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>"; var offline = \'<span style=\"padding-left:0px; width:100%; background-color:transparent; color:#ff0033; font-size:11px; text-decoration:none; text-align:left\">CHAT OFFLINE</span>\'; document.write(\'<\' + \'script type="text/javascript" src="http://'.$host.'/chat/'.$username.'/'.$profemail2.'/chat2.js"></\' + \'script>\');</script>() Quote Link to comment https://forums.phpfreaks.com/topic/255053-how-to-output-java-var-in-html-on-php-page/#findComment-1307825 Share on other sites More sharing options...
trq Posted January 15, 2012 Share Posted January 15, 2012 What is with all the backslashes? That is not at all valid JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/255053-how-to-output-java-var-in-html-on-php-page/#findComment-1307834 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.