Hey chrisjchrisj, and welcome to the forums! Apologies it took a while to respond.
Can you explain a bit regarding where the user's input is coming from? Is the user entering text into the form and then it is shown to them straight away? Or is it uploaded to a storage system (e.g., a database).
If it's being displayed straight away, you can use pure javascript (no PHP) to achieve what you're describing.
e.g., If you have the form and marquee HTML setup as follows
HTML Code:
<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">
<h4>Your scroller contents</h4>
</div>
</div>
<form action="#" id="myForm">
Comments:<br />
<textarea name="comments" id="comments" minlength="20" maxlength="120" rows="14" cols="130" form="myForm">Hey... say something!</textarea>
<br />
<input type="submit" value="Submit">
</form>
You could use the following javascript code (you'll also need the Cross Browser marquee II script included)
HTML Code:
<script type="text/javascript">
//Bind an event to run after the page is ready, so that we can interact with the DOM elements on the page.
document.addEventListener("DOMContentLoaded", () => {
//Get a reference to the form and the marquee DOM elements.
const form = document.getElementById("myForm");
const marquee = document.getElementById("vmarquee");
//Bind an event to trigger when the form is submitted.
form.addEventListener("submit", event => {
//Set the marquee's text to the contents of the input inside the form named "comments".
marquee.textContent = form.elements["comments"].value;
//Prevent the form from submitting.
return false;
});
})
</script>
Bookmarks