PHP echo in Javascript
Posted
by
DonCroce
on Stack Overflow
See other posts from Stack Overflow
or by DonCroce
Published on 2011-01-05T18:28:01Z
Indexed on
2011/01/05
18:54 UTC
Read the original article
Hit count: 119
php
|JavaScript
I have this code:
document.getElementById('root').style.left = '<?php echo $page_position[$info["os"]][$info["browser"]][0]; ?>';
document.getElementById('root').style.top = '<?php echo $page_position[$info["os"]][$info["browser"]][1]; ?>';
Why won't this work like this?
Can anybody point me in the right direction?
EDIT:
<?php echo $page_position[$info["os"]][$info["browser"]][1]; ?>
echoed "top:300px;"
Sorry guys, very stupid error of mine :/
© Stack Overflow or respective owner