1)Write a web page which has a textarea, a checkbox, and a button. When the user clicks the button checkbox is unchecked whatever text is in the text area is appended to the page as a new paragraph element. If the user clicks the button and the checkbox is checked the current output on the page is cleared and the contents of the text area replace whatever was there. Focus should be given to the text area when the page is loaded and restored after the button is clicked. Label the controls appropriately. Format the page using CSS.
i am having issues with this even getting the .value from the textarea. So i must be missing something here. I am not the best at this and any info would help.
Javascript
window.onload = function() {
document.getElementById("paste").onclick = function click() {
var TypedText = document.getElementById('box1').value;
var paragraph = ""
var append = document.getElementById('form1').append;
var getInfo = document.getElementById('ParaWrite');
if (append.checked === true)
paragraph += "<p>"TypedText"</P>";
else
paragraph == TypedText;
getInfo.innterHTML = paragraph;
}
}
HTML
<!doctype html> <html> <head> <meta charset="utf-8"> <title>TeXt BoX</title> <link rel="stylesheet" href="../css/normalize.css"> <link rel="stylesheet" href="Textbox.css"> </head> <script type="text/javascript" src="TextParatest.js"></script> <body> <h1></h1> <form name="form1" id="form1"> <input type='checkbox' name='write' id='write' value='Check' /> <label for='write'>Append Paragraph</label><br/> <textarea type="text" id="box"/></textarea> <input type='button' value="Paste typed text" id='Paste'/> </form> <p id="lame"></p> </body> </html>
Look for your reply

New Topic/Question
Reply


MultiQuote





|