Web Analytics Made Easy -
StatCounter Dynamic Content - CodingForum

Announcement

Collapse
No announcement yet.

Dynamic Content

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    Do you mean you want to hide/show text if something is selected?

    Comment


    • #3
      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...

      Comment


      • #4
        Soory I still don't understand. What do you mean by div or table id?

        Comment


        • #5
          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"

          Comment


          • #6
            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.

            Comment


            • #7
              Wonderful...I'll give this a try and will let you know if it works for me...

              Thanks again...

              Comment


              • #8
                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');

                Comment


                • #9
                  Unless I find another way, I will be doing a lot of document.writes. Thanks alot for the code...

                  Comment

                  Working...
                  X