div question

Discussion in 'HTML' started by Aaron Fude, Jul 12, 2004.

  1. Aaron Fude

    Aaron Fude Guest

    Hi,

    Is there a way to define the content of a div or a span in one place, but
    then place it in the document in another place? I do not want to do absolute
    position. I will probably want to include that span in a table cell. The
    reason I want to do this is to make the table code nice and compact and to
    be able to see the table structure even if the div has long content.

    Many thank in advance,

    Aaron Fude
     
    Aaron Fude, Jul 12, 2004
    #1
    1. Advertising

  2. Aaron Fude

    rf Guest

    "Aaron Fude" <> wrote in message
    news:ccu1dv$1vpm$...
    > Hi,
    >
    > Is there a way to define the content of a div or a span in one place, but
    > then place it in the document in another place? I do not want to do

    absolute
    > position. I will probably want to include that span in a table cell. The
    > reason I want to do this is to make the table code nice and compact and to
    > be able to see the table structure even if the div has long content.


    No.

    Well... yes if you code your server side process correctly.

    But why bother, why should a table cell contain so much anyway, that is if
    it *is* tabular data?

    --
    Cheers
    Richard.
     
    rf, Jul 12, 2004
    #2
    1. Advertising

  3. Aaron Fude

    brucie Guest

    in post: <news:ccu1dv$1vpm$>
    Aaron Fude <> said:

    > Is there a way to define the content of a div or a span in one place, but
    > then place it in the document in another place?


    http://allmyfaqs.com/faq.pl?Include_one_file_in_another

    > The reason I want to do this is to make the table code nice and
    > compact and to be able to see the table structure even if the div has
    > long content.


    thats fine using the server side options at the link above before the
    server does its majic but the end result spat out at the browser end
    will have the <td> containing goodies.

    and just in case you're using <table>s for layouts. <smack on wrist/>
    stop it. use css.


    --
    b r u c i e
     
    brucie, Jul 12, 2004
    #3
  4. Aaron Fude

    Aaron Fude Guest

    "brucie" <> wrote in message
    news:1kvwsha878t8l$...
    > in post: <news:ccu1dv$1vpm$>
    > Aaron Fude <> said:
    >
    > > Is there a way to define the content of a div or a span in one place,

    but
    > > then place it in the document in another place?

    >
    > http://allmyfaqs.com/faq.pl?Include_one_file_in_another
    >
    > > The reason I want to do this is to make the table code nice and
    > > compact and to be able to see the table structure even if the div has
    > > long content.

    >
    > thats fine using the server side options at the link above before the
    > server does its majic but the end result spat out at the browser end
    > will have the <td> containing goodies.
    >
    > and just in case you're using <table>s for layouts. <smack on wrist/>
    > stop it. use css.
    >


    ok, ok - I'll reveal what I'm really trying to do. I have a page with a lot
    of content. It is tablular data and the able has 1000 lines. I was planning
    to break it up into 20 tables with 50 rows each. I will then use COOLjsTree
    (http://javascript.cooldev.com) to hide all but one table. The darn thing
    is, COOLjsTree requires its HTML content to be a valid javascript string
    which is cubersome for a table with 50 lines. So I thought I would put that
    table in a div and just mention the dive in the javascript string.

    Here's an example for COOLjsTree developers (which I think is ugly):

    var t1 = '<table bgcolor="#4682B4" width="400" cellspacing="0"
    cellpadding="0" border="0"><tr><td align=center><font
    color=white><b>Personal Info</b></font></td><tr></table>';
    var f1 = '</a><table width="400" cellspacing="0" cellpadding="0"
    border="0"><tr><td bgcolor="#EEEEEE">';
    f1 += '<table width="100%" cellspacing="2" cellpadding="2" border="0">';
    f1 += '<form action="javascript:alert(\'Submitted\');" method="get">';
    f1 += '<tr><td><p class="last">First Name</td><td><input
    type="text"></td></tr>';
    f1 += '<tr><td><p class="last">Last Name</td><td><input
    type="text"></td></tr>';
    f1 += '<tr><td><p class="last">Age</td><td><select><option>from 10 to
    15<option>from 16 to 20<option>from 21 to 30<option>from 31 to
    40<option>older 40</select><td></tr>';
    f1 += '<tr><td colspan=2 align=center><input type="submit"
    value="Submit">&nbsp;<input type="reset" value="Reset"></td></tr>';
    f1 += '</form>';
    f1 += '</table></td></tr></table>';

    .... lator on f1 is used:

    var FORM_NODES = [
    [t1, null, null,
    [f1, null, null],
    ],


    SO, I'm looking to avoid creating a long javascript string wih HTML content.

    >
    > --
    > b r u c i e
    >
    >
     
    Aaron Fude, Jul 12, 2004
    #4
  5. Aaron Fude wrote:

    > ok, ok - I'll reveal what I'm really trying to do. I have a page with a lot
    > of content. It is tablular data and the able has 1000 lines. I was planning
    > to break it up into 20 tables with 50 rows each. I will then use COOLjsTree
    > (http://javascript.cooldev.com) to hide all but one table. The darn thing
    > is, COOLjsTree requires its HTML content to be a valid javascript string
    > which is cubersome for a table with 50 lines. So I thought I would put that
    > table in a div and just mention the dive in the javascript string.


    Yuk. Use PHP and put the table content into a database. Then you can
    dynamically generate separate pages for each of the 20 sub-tables.

    PHP and MySQL rules, and takes way less time to learn than you might
    think. My site is entirely generated thusly, and performance is
    excellent, even on the old P100 that's serving it.

    --
    Mark.
    http://tranchant.plus.com/
     
    Mark Tranchant, Jul 12, 2004
    #5
  6. Aaron Fude

    Dylan Parry Guest

    Aaron Fude wrote:

    > I will then use COOLjsTree (http://javascript.cooldev.com) to hide all
    > but one table. The darn thing is, COOLjsTree requires its HTML content
    > to be a valid javascript string which is cubersome for a table with 50
    > lines. So I thought I would put that table in a div and just mention the
    > dive in the javascript string.


    Hmm, that's a damned ugly way of doing it. A better idea, that will still
    work when JavaScript is disabled, would be to give each table an id (eg.
    table1, table2, table3 etc) and then have a script that is called through
    the onload() event in the body element.

    The script would then loop through each of the table ids and set the
    display property for that element to "none", obviously leaving one of the
    tables displayed.

    Then it's just a matter of creating a link for each table that when
    clicked does the opposite of the onload() script. These links can also be
    written out with JavaScript so that script-disabled browsers don't see
    them.

    See http://www.webpageworkshop.co.uk/main/article11 for an example of how
    this can be done with lists. Adapting it to table shouldn't be too hard a
    task.

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
     
    Dylan Parry, Jul 12, 2004
    #6
  7. Aaron Fude

    Webcastmaker Guest

    In article <ccu45r$2da0$>,
    says...
    > ok, ok - I'll reveal what I'm really trying to do....


    Oh you are headed in the right direction...

    > I have a page with a lot...

    <snip>

    Is putting each set of 50 on a different page not an option? With a
    link to all 20 pages included somewhere on each page so you can jump
    around. That would probably work on all browsers. If you want
    javascript, then google "collapsible div DHTML" and you will be
    rewarded with a ton of examples.


    --
    WebcastMaker
    The easiest and most affordable way to create
    Web casts, or put presentations on the Web.
    www.webentations.com
     
    Webcastmaker, Jul 12, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,671
    Josef K.
    May 22, 2005
  2. dunnil
    Replies:
    1
    Views:
    744
    Neredbojias
    Feb 5, 2006
  3. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    787
  4. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    218
    David Dorward
    Jun 1, 2005
  5. mscir
    Replies:
    3
    Views:
    342
    Martin Honnen
    Jun 26, 2005
Loading...

Share This Page