开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜