Solved

Change textarea onclick (with html)

Posted on 2006-06-29
4
1,534 Views
Last Modified: 2012-08-14
Hi,

I have a menu on the left of my page and when a button is clicked, i want the textarea in the middle of the page to change.  I figured out how to do that, but only in plain text.  When i change the value to hey<br>hi, it shows that exactly, but i want it to show:

hey
hi

is there a way to do this with a textarea?  Or is there another way to do this that is easier?  Thanks!
-Kyle
0
Comment
Question by:kylen1010
  • 2
  • 2
4 Comments
 
LVL 2

Author Comment

by:kylen1010
Comment Utility
I know it's spaced really weird, but here is the code.  Thanks!


<html>
<head>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css">
</head>
<body>
<form name="form" id="form">
<input type=hidden id="homehidden" value="
HOME<br>hey2
"><input type=hidden id="abouthidden" value="
about
"><input type=hidden id="10hidden" value="
10 goals
"><input type=hidden id="rockshidden" value="
rocks
"><input type=hidden id="topicshidden" value="
topics
"><input type=hidden id="meetingshidden" value="
meetings
">
<table width=100% border=1 class="h3">
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('homehidden').value" style="cursor:pointer;cursor:hand"><img src="home.gif" height=70></a></td><td rowspan=6><textarea cols=100 rows=20 readonly id="bodyfdsfadsf" class="textarea">hey<br>hi</textarea></td></tr>
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('abouthidden').value" style="cursor:pointer;cursor:hand"><img src="about.gif" height=70></a></td></tr>
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('10hidden').value" style="cursor:pointer;cursor:hand"><img src="10.gif" height=70></a></td></tr>
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('rockshidden').value" style="cursor:pointer;cursor:hand"><img src="rocks.gif" height=70></a></td></tr>
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('topicshidden').value" style="cursor:pointer;cursor:hand"><img src="topics.gif" height=70></a></td></tr>
<tr><td><a onclick="document.getElementById('body').value = document.getElementById('meetingshidden').value" style="cursor:pointer;cursor:hand"><img src="meetings.gif" height=70></a></td></tr>

</body>
</html>
0
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 135 total points
Comment Utility
textarea, as its names indicates, displays text, not html.

if you want a line break between "HOME" and "hey2", use this:

<input type=hidden id="homehidden" value="
HOME
hey2
">

if you want to display HTML, then use an iframe.

note that you should rename id="bodyfdsfadsf" into id="body"
... and maybe use some othe id than "body", it's confusing.
0
 
LVL 2

Author Comment

by:kylen1010
Comment Utility
Thank you GrandSchtroumph!  I decided to just use iframes.  Thanks!
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
Comment Utility
:)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now