php var inside javascript
How can i use this variable insi开发者_运维百科de this?
<script language="JavaScript">document.title = "{$row['subject']} - Forum - Terraria 7.6";</script>
Tried every way
document.title = "<?php echo $row['subject'] ?> - Forum - Terraria 7.6";
Wrap it in <?php
tags:
<script type="text/javascript">
document.title = "<?php echo $row['subject']; ?> - Forum - Terraria 7.6";
</script>
Also, the language
attribute is depreciated. Don't use it. Use the type
instead.
output the var in <?php ?>
tags
<script type="text/javascript">document.title = "<?php echo $row['subject']; ?>
- Forum - Terraria 7.6";</script>
精彩评论