WandaL
06-24-2002, 11:36 PM
I am new to DHTML but I know enough to tweak code. What I need to do I think is very simple:
I have an include file that has 2 table rows. On the second row, I would like to pull a name from a separate file that has a list of several names. I can create the names list file in whatever way is best to make this work.
Does anyone know where I can find a script/code that will do this?
Thanks...
Graeme Hackston
06-25-2002, 12:22 AM
Do you mean you want to hide/show text if something is selected?
WandaL
06-25-2002, 12:31 AM
I guess what I'm trying to do is dynamically display a name that can be pulled based on some criteria on the page such as a div or table id.
In other words, depending on the criteria used (div or table id), a name is displayed. This name will reside in and be pulled from a different file/page.
I hope this is better...
Graeme Hackston
06-25-2002, 12:39 AM
Soory I still don't understand. What do you mean by div or table id?
WandaL
06-25-2002, 01:36 AM
Okay, I have the following table
<table width="75%" border="1" name="Something">
the content owners name would sit in a cell in this table. Each content page would have the same table and the only difference would be the name of the table.
I would like to have some type of function that would put a name in the table cell, based on the name of the table. For example:
function conowner()
if table.name=Something document.write "Wanda Love"
else
if table.name=Other then document.write "Graeme Hackston"
Graeme Hackston
06-25-2002, 01:49 AM
I believe this works in all DOM browsers.
function conowner() {
if (document.getElementById('Wanda Love')) {
document.write('Wanda Love');
} else {
if (document.getElementById('Graeme Hackston')) {
document.write('Graeme Hackston');
}
<table width="75%" border="1" id="Wanda Love">
I believe you'll have to use id and not name.
WandaL
06-25-2002, 01:57 AM
Wonderful...I'll give this a try and will let you know if it works for me...
Thanks again...
Graeme Hackston
06-25-2002, 02:06 AM
No problem, another member gave me that bit of code just a week or 2 ago.
If your doing lots of document writes you might want to use this at the beginning of your scripts to reduce code bloat.
function w(onestring) {
document.write(onestring);
}
Then
w('Wanda Love');
WandaL
06-25-2002, 02:57 PM
Unless I find another way, I will be doing a lot of document.writes. Thanks alot for the code...