Solved

Change textarea onclick (with html)

Posted on 2006-06-29
4
1,535 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
ID: 17012489
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
ID: 17012667
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
ID: 17013401
Thank you GrandSchtroumph!  I decided to just use iframes.  Thanks!
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 17013695
:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

15 Experts available now in Live!

Get 1:1 Help Now