Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.