Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Html question - help please? 1

Status
Not open for further replies.

computergeek

Programmer
May 23, 2001
193
CA
Hello,

I am trying to create an object that resembles a glass or tank on the window. I want to dynamically adjust the level in the glass (tank) based on a data value. Does anyone know how to do this in DHTML?

This is what I have tried so far...

<TABLE WIDTH=&quot;25%&quot; BORDER=3 CELLSPACING=0 CELLPADDING=0>
<TD width=&quot;125&quot; height=&quot;100&quot; bgcolor=white>
<TABLE WIDTH=&quot;25%&quot; BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TD width=&quot;125&quot; height=<%variablepercent%>bgcolor=&quot;#99ccff&quot;>
</TD>
</TABLE>
</TD>
</TABLE>

Basically I am trying to have a cell with a white background and with a border, then I want a blue cell on top to be dynmically set based on a variable contained within my ASP page.

Any ideas? Any DHTML code somewhere that does this?

Thanks,

Computergeek
 
Hi,

Thanks for your replies...

Using images I don't think would be feasible as you would need so many. i.e. 5%, 10%, 20%, 30%, 40%... I think it would probably be better to have this dynamic.

The DOM? Document ? ?

I think my above solution could work. The problem seems to be with handling the tables...How do you correctly place a TD cell on top of another TD cell? If this approach ends up working I plan to replace the white background TD cell with an image. Where is a good place to find such an image?

Thanks for you input.

Computergeek
 
Hi Computergeek,

I think you mean something like a bar-chart? I think you better generate this with server site script.

I didn't examine this examples below (only did a quick search), but maybe these can help you solving your CHALLENGE LOL



Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 

This is a type of bar chart but yours is pretty simple. Try this:

<TABLE WIDTH=&quot;25%&quot; height=&quot;100&quot; BORDER=3 CELLSPACING=0 CELLPADDING=0>
<tr><td bgcolor=white></td></tr>
<tr><td valign=&quot;bottom&quot; height=<%variablepercent%> bgcolor=&quot;#99ccff&quot;></td></tr>
</TABLE>

The trick is to have a white row on top of the blue.

What do you think?
 
Hi,

Thanks AlaskanDad. It's seems to work ok. Now how to line this object side by side to another table... Any ideas?


<TABLE WIDTH=&quot;15%&quot; height=&quot;100&quot; BORDER=2 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD bgcolor=white> </TD>
</TR>
<TR>
<td valign=bottom height=&quot;<%=CalcTankHeight()%>%&quot; bgcolor=&quot;#99ccff&quot;></TD>
</TR>
</TABLE>


<TABLE WIDTH=&quot;70%&quot; BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD>
<B>
HIHI:
</B>
</TD>

<TD>.....

Computergeek
 
Try this:

<TABLE WIDTH=&quot;100%&quot; BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD WIDTH=&quot;25%&quot;>

<TABLE WIDTH=&quot;100%&quot; height=&quot;100&quot; BORDER=2 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD bgcolor=white> </TD>
</TR>
<TR>
<td height=&quot;30&quot; bgcolor=&quot;#99ccff&quot;></TD>
</TR>
</TABLE>
</TD>

<TD WIDTH=&quot;75%&quot; WIDTH=&quot;30%&quot;>
<TABLE WIDTH=&quot;100%&quot; BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD>
<B>
HIHI:
</B>
</TD>
</TR>
</TABLE>

</TD>
</TR>

</TABLE>

Just encase your two tables in a bigger table. Be sure to take out the borders where you don't want them. I turn them on just to see how much space they're taking up.
 
Hi,

It's Computergeek again... everything looks great! Thanks for your help.

AlaskanDad, I assume your from Alaska... where?

I am from Calgary, Canada.

Computergeek
 
Used to be from Fairbanks til we picked up and moved to the lower 48.

Thanks for the compliment, but where's my star, eh?

North Country humor.
 
Hi AlaskanDad,

Ha! Ha! on the eh! thing... Yes, it is very true we say that at the end of sentences a lot. Almost every time we go the U.S. someone says we have an accent... we don't think we do...but, then again people from Texas don't think they have an accent either?!

&quot;but where's my star, eh?&quot; The thing about the star went right over my head,eh?! What's this all about? Am I sleeping, or did I miss something... : o )

Computergeek
 
Look at the bottom of my post:
&quot;Click here to mark this post as a helpful or expert post!&quot;


Oh, yah! Runnin' from dem moooose in da cold makes ya talk funny!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top