Ok this is wheat I have so far. IF someone could help me out. I had to change the color of the background when you click on a button. And I also have to Use document.getElementById('yourelementid') to both find the value of the textarea and to change the basic text created in the div. But I don't know how to do that i have been researching online. I think i am getting a little confused about where to put things at in here thanks.
Here is what I have so far....
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>
<title>DOM</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<script language="JavaScript">
<!-- Begin
function newbg(thecolor)
{
document.bgColor=thecolor;
}
// End -->
</script>
<body>
<h3>DOM Assignment Examples</h3>
<div>
<form>
<h4>Change background color to:</h4>
<input type="radio" value="White" onclick="newbg('white');">white<br/>
<input type="radio" value="Blue" onclick="newbg('blue');">Blue<br />
<input type="radio" value="Beige" onclick="newbg('Beige');">Beige<br />
<input type="radio" value="Yellow" onclick="newbg('yellow');">Yellow<br />
</form>
</div>
<br />
<br />
<br />
<h4>add text to this box change the text below:</h4>
<TEXTAREA NAME="" ROWS="10" COLS="40" onBlur="blurHandlerRouting">
You will change this text
</TEXTAREA> <br />
<INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)">
</body>
</html>
To format the text in the text box, select it, and then Control + Click the text and select Font. To add different effects to the text box, select the text box, and use the options on the Shape Format tab (such as changing the text direction or aligning the text at the top, middle or bottom of the text box).
Right-click the text box that has the formats you want to use as the default. On the shortcut menu, click Format Text Box, and then click the Colors and Lines tab. Select the Apply settings to new text boxes check box. Click OK.
After you insert a text box on a form template, you can customize it by accessing and changing its properties and settings in the Text Box Properties dialog box. To open the dialog box, on the form template, double-click the text box whose properties you want to change.
On the Insert tab, in the Text group, click Quick Parts. Right-click anywhere in the gallery pane and choose Organize and Delete from the context menu. In the dialog box that appears, select the entry you want to modify and click Edit Properties… Make the changes and click OK to save them.
The contents of a <textarea>
can be manipulated using .html()
in jQuery or .innerHTML
in vanilla JavaScript.
Your HTML should contain the id=""
attribute:
<textarea id="mytextarea">Text to be changed</textarea>
And the JavaScript:
document.getElementById('mytextarea').innerHTML = "New Text";
To change the background and the textarea you would try this:
function = testResults(){
document.getElementById("yourTextBoxId").style="background:red;"; //Change the background color to red.
document.getElementById("yourTextAreaId").value="your another text for the textarea"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With