phpgoal Posted June 13, 2013 Share Posted June 13, 2013 Hello, I simply want to print out a javascript variable in html. How can i do it? <html> <body> <script type="text/javascript"> if (datestr == 'September 2020') {var newdate = 'September 2020';} </script> // How to store the newdate into another variable and how to print it in html. </body> </html> Link to comment https://forums.phpfreaks.com/topic/279116-print-javascript-variable/ Share on other sites More sharing options...
Psycho Posted June 13, 2013 Share Posted June 13, 2013 Assuming you have an element to put hte date in, such as a DIV <div id="date_output"></div> You could do something like this: document.getElementById('date_output').innerHTML = datestr; Link to comment https://forums.phpfreaks.com/topic/279116-print-javascript-variable/#findComment-1435756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.