Forum Moderators: not2easy

Message Too Old, No Replies

dynamic populate

         

ArrTu

9:39 pm on May 17, 2004 (gmt 0)

10+ Year Member



I have just started using css instead of tables after years of shunning css due to limitations I found in its infancy.

I have created a page exactly as I want it, only I want to include a separate "cell" (for want of better description)which is populated by text depending upon a form selection. I know javascript is used...I already have several table based pages with what I am looking for.(included at the foot of the message is a working version with just enough essential parts - if you are not sure what im talking about run it in the body of an html doc)

I'm pretty certain that instead of populating a textarea I can populate a css decalred area with said text. Am I right, or should I just stick with floating a textarea?


<form name="journal">

<select name="selectwho" size="1" onChange="showtext()" style="background-color:darkred; color:yellow">
<option value="select" readonly Selected>Select from the list></option>
<option value="7" readonly>Faith's thoughts</option>
<option value="8">Robert's thoughts</option>
</select>
<textarea rows=6 cols=60 wrap="physical" name="show" readonly>Now select your level</textarea>

<script language="javascript">

var thoughts=document.journal

var description=new Array()

description[0]="Select"

description[1]="faiths stuff goes here"

description[2]="Robert's stuff goes here"

function showtext(){
thoughts.show.value=description[thoughts.selectwho.selectedIndex];
}

</SCRIPT>

</FORM>

SuzyUK

12:42 pm on May 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi ArrTu,

CSS cannot "dynamically" populate a Div (well not yet.. CSS3 and the generated content properties may be an answer), it's not a scripting language.

However what you could do is have the different "textarea" content in seperate divs and toggle the visibility of each div depending on which link (a list of links in place the select box) is moused over/clicked (if you want it to be onclick, you will still need some form of javascript)

perhaps a form of "tabbed menu" script could be used.. there are others here better at Javascript than I but if you search for tabbed CSS menus you will see lots of solutions, depending on if you want the whole page to change or target an iframe, or toggle div visibility..

Suzy