EchoFool Posted August 21, 2009 Share Posted August 21, 2009 Hey, I have a div which is linked with my JS script but im getting a syntax error for my function but not sure why... here is the function in JS function dochatbox(){ var chatbox = document.getElementById('chatdiv'); // var chatbox = 'chatdiv'; chatbox.scrollTop = chatbox.scrollHeight; } My div: <div id="chatbox" > <div id="chatdiv" style="border : solid 0px padding : 1px; width : 100%; height : 70px; overflow : auto;"> <? echo stripslashes($chat); ?> </div> </div> But i get this error: syntax error http://localhost/js/javascript.php Line 5 [break on this error] var chatbox = document.getElementById('chatdiv'); \n Any one know what i got wrong? Link to comment https://forums.phpfreaks.com/topic/171314-syntax-issue/ Share on other sites More sharing options...
haku Posted August 22, 2009 Share Posted August 22, 2009 Try using double quotes. Link to comment https://forums.phpfreaks.com/topic/171314-syntax-issue/#findComment-903734 Share on other sites More sharing options...
corbin Posted August 22, 2009 Share Posted August 22, 2009 Single or double quotes shouldn't matter... If changing it to double quotes, can we see more code? Link to comment https://forums.phpfreaks.com/topic/171314-syntax-issue/#findComment-903752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.