Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Dynamic Tables


Message #1 by "Chris Thompson" <cthompson@n...> on Wed, 14 Aug 2002 09:36:02 -0600
I ended up doing this in VBSCRIPT, but the actual code below could
easily be switched to Javascript.

First I have a function in the script tags like this:

<SCRIPT LANGUAGE=3D'VBSCRIPT'>
Private function DoCalender(d, b)
	Dim strHTMLText
<SNIP>

	document.getElementById("test").innerHTML =3D strHTMLText
end function
</SCRIPT>


In this case I pass in come variables, process them and create the HTML
code and load it into the variable strHTMLText.

Down in the body of the HTML I have this line:

<DIV NAME=3DTEST ID=3DTEST></DIV>

I also have this line in the BODY Tag so it runs one when the page
loads:

ONLOAD=3D'vbscript:DoCalender date,"TEST"'

I was playing with a second variable so I could have multiple instances
use the same code.  The item "TEST" is the name of the DIV tag.  The
last line of the function I first listed it what writes it to the DIV
tag.  Every time you run the function, it replaces the code in the DIV
tag.  You then just need a button or something to trigger the function
every time you want it changed and change whatever you want in the
function itself to reflect the change.  My code that it generates
changes depending on the values passed into it.  Hope this helps.

Thanks,

Chris Thompson

-+-+-+-+-+-+-+-+-+-+-+-
cthompson@n...
xxx-xxx-xxxx
-+-+-+-+-+-+-+-+-+-+-+-



-----Original Message-----
From: Sten Hougaard [mailto:STG@e...]
Sent: Thursday, August 15, 2002 12:32 AM
To: JavaScript HowTo
Subject: [javascript_howto] RE: Dynamic Tables


Hi Chris,

That is great - you figured it out :-) - But how? Perhaps you care to
share
it with us,
just as we were just to share a soloution with you ;-)

Med venlig hilsen

Sten Hougaard





                    "Chris

                    Thompson"            To:     "JavaScript HowTo"
<javascript_howto@p...>               
                    <cthompson@n...       cc:

                    tah.com>             Subject:     [javascript_howto]
RE: Dynamic Tables                       


                    14-08-2002

                    22:36

                    Please respond

                    to "JavaScript

                    HowTo"









Never mind, I figured it out.

Thanks,

Chris Thompson



-----Original Message-----
From: Chris Thompson
Sent: Wednesday, August 14, 2002 9:36 AM
To: JavaScript HowTo
Subject: [javascript_howto] Dynamic Tables

I have a table I have coded.  I want the table to be dynamic.  I have
some client side code that allows the user to click a cell and get a
reaction.  I want to change this table depending on what the user
clicks.  For example, lets say I have 3 cells in the table.  The first
says 'Previous', the middle says '5' and the last cell says 'Next'.  If
they press next, I want the table to now read the 3 cells as
"previous','6','Next'.  Hope this makes sense.  I am not sure how to
dynamically change a table.  I am not even sure it is possible, but it
seems like it was.  Any help would be greatly appreciated as this is a
large hurdle slowing my progress at this point.

Thanks,

Chris Thompson


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20





---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20

  Return to Index