Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Passing data to <DIV> from event driven functions


Message #1 by "Nathan Garretson" <nate@z...> on Mon, 1 Jul 2002 16:05:08
Hello Nathan,
Try this example. I hope that's what you need.

<html>
<head>
<title>
</title>
<script>
function addText(t){
 document.all.divID.innerText=t;
}
</script>
</head>
<body>
<input type="text" size=10 name="t1">
<input type="button" value="addtext" onClick="javascript:addText
(document.all.t1.value)">
<div id="divID">

</div>


</body>
</html>



> Everyone,
> 
> This is the problem, I want to create a <div> "box" on my page and I
> plan 
> on outputting an array of strings to it. Sound simple enough call the 
> function from with the div tags. However this array is populated by the
> user using events. So Im looking to "refresh" this box with an event
> off a 
> button. Problem is output from my function goes to a new page. Is there
> anyway I can have the output go to the div tag, similar to targeting
> input 
> fields with the document.form.blah.value deal? I dont want to use and 
> input box because the formatting abilities within it are so limited.
> 
> Thanks.
> 
> Nathan
> 
> ---
> 
> Improve your web design skills with these new books from Glasshaus.
> 
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramm
> e
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramm
> e
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramm
> e
> r-20



  Return to Index