mme Posted January 20, 2011 Share Posted January 20, 2011 Hi, I am trying to make it so I can pass a new line of text from php to the ajax script while it is being executed. Then displaying this text on a new line each time (kind of a scroll log in Wordpress when it is updating plugins) example: <div id='mydiv'>text already here<p /> addtext('some text'); would add 'some text' to the existing text in a div <div id='mydiv'>text already here<p />some text Can anybody give me a simple tutorial or an explanation. Thanks, -mme Quote Link to comment https://forums.phpfreaks.com/topic/225077-text-scroller/ Share on other sites More sharing options...
PaulRyan Posted January 23, 2011 Share Posted January 23, 2011 You will need to close you DIV properly using </div>. Here is some code that I quickly put together: <script type="text/javascript"> <!-- // function to add text to our DIV function addtext(text) { // We get or DIV and add the text to the end of the current content // Alot simpler than you think by just using += instead of CONTENT+TEXT document.getElementById('mydiv').innerHTML+='<br>'+text; } //--> </script> <input type="button" value="Add Some Text?" onClick="addtext(this.value);"> <div id='mydiv'>text already here</div> Hopefully that will give you some understanding Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/225077-text-scroller/#findComment-1163774 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.