Jump to content

Text Scroller


mme

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/225077-text-scroller/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/225077-text-scroller/#findComment-1163774
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.