Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: Dynamic Content

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamic Content

    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...

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you mean you want to hide/show text if something is selected?

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Soory I still don't understand. What do you mean by div or table id?

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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"

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wonderful...I'll give this a try and will let you know if it works for me...

    Thanks again...

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    624
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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');

  • #9
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unless I find another way, I will be doing a lot of document.writes. Thanks alot for the code...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •