Need javascriptor
•
11 Sep 2007, 20:46
•
Journals
Hello, i would like some expert advice, im putting a textbox up and people are supposed to spam into it, then click a button and it will be displayed beneath the button. The problem is that it needs to just go one line beneath the last time it clicked the button, but it always resets itself.
The code!
<html>
<script type="text/javascript">
function change()
{
var texti = document.getElementById("textaformid").elements[0].value;
texti = texti.replace(/\n/g, "<br/>")
document.getElementById("textaformid").elements[0].value = "";
document.getElementById("prentatexta").innerHTML = texti;
}
</script>
<body>
<form id="textaformid" action="">
<p>Sláið inn texta og ýtið á hnappinn! </p>
<p><textarea id="textaformid" cols="30" rows="10"></textarea></p>
<p><input type="button" onClick="change()" value="Senda"></p>
</form>
<table><tr><td id="prentatexta"><br></td></tr></table>
</body>
</html>
The code!
<html>
<script type="text/javascript">
function change()
{
var texti = document.getElementById("textaformid").elements[0].value;
texti = texti.replace(/\n/g, "<br/>")
document.getElementById("textaformid").elements[0].value = "";
document.getElementById("prentatexta").innerHTML = texti;
}
</script>
<body>
<form id="textaformid" action="">
<p>Sláið inn texta og ýtið á hnappinn! </p>
<p><textarea id="textaformid" cols="30" rows="10"></textarea></p>
<p><input type="button" onClick="change()" value="Senda"></p>
</form>
<table><tr><td id="prentatexta"><br></td></tr></table>
</body>
</html>
+ document.getElementById("prentatexta").innerHTML += texti;
?
<html>
<script type="text/javascript">
function change()
{
var texti = document.getElementById("textaformid").elements[0].value;
texti = texti.replace(/\n/g, "<br/>")
//(document.getElementById("textaformid").elements[0].value = "";
document.getElementById("prentatexta").innerHTML += "<br>";
document.getElementById("prentatexta").innerHTML += texti;
}
</script>
<body>
<form id="textaformid" action="">
<p>Sláið inn texta og ýtið á hnappinn! </p>
<p><textarea id="textaformid" cols="30" rows="10"></textarea></p>
<p><input type="button" onClick="change()" value="Senda"></p>
</form>
<table><tr><td id="prentatexta"><br></td></tr></table>
</body>
</html>
function change() {
var texti = document.getElementById("textaformid").elements[0].value + "\n";
document.getElementById("prentatexta").innerHTML += texti.replace(/\n/g, "<br/>");
}
I don't know any JS, though. :D