37 users online (0 members and 37 guests)  


  Results 1 to 3 of 3

Related

  1. onClick and <iframe>    Forum: HTML Forum
    Replies: 4
  2. Onclick Listbox    Forum: Javascript Forum
    Replies: 2
  3. onClick problem    Forum: Javascript Forum
    Replies: 1
  4. onclick help    Forum: Javascript Forum
    Replies: 3
  5. onClick on php?    Forum: PHP Forum
    Replies: 1
  1. #1
    Auron's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    3

    Onclick Alterations ((.innertext bug?))

    Heh heh, first post on the site, so, not sure about some termology, so I'm sorry if I got java or some such thing mixed in by accident. I'm a code junky like that. >_<'
    <!---Testing a new concept-->
    <div id="texta"
    onclick="texta.innertext=''"
    onclick="textb.innertext='Title'"
    onclick="textc.innertext='Description'">Title</div>
    <div id="textb"
    onclick="texta.innertext='Title'"
    onclick="textb.innertext=''"
    onclick="textc.innertext=''"></div><br>
    <div id="textc"></div>
    The idea is that when you click the title, then it would display relivant text somewhere on the page, and if you clicked it agian, take it off. I plan to compile many diffrent titles that will change text in a single area, thus sharing space on the page and compacting the entire thing greatly. Problem is, I've messed up somewhere, and it won't really do anything 'onclick' when I try it...

    My motto, simple but elegant is failing me, isn't it?..

  2. #2
    Auron's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    3

    Re: Onclick Alterations ((.innertext bug?))

    Double post, yes, but just pretend I'm someone else for the sake of getting answers out there for those who might need them.

    .innerText must be placed with the T in text capped. It's also easier to condense such coding if you use
    onclick="texta.innerText='';textb.innerText='Title';textc.innerText='Description'"
    Or the proper variation for each area. Umm, as for in practice, DIV tags will create new areas, so if you want one word clickable items in the midsts of a paragraph, then you'll most likely need to use a font or bold tag, or something along those lines. Tables could also work as I'll demonstrate.
    <!---Testing a new concept-->
    <TABLE>
    <TR>
    <TD id="itema" onclick="desc.innerText='Description of Item A.'">Item A</TD>
    <TD id="itemb" onclick="desc.innerText='Description of Item B.'">Item B</TD>
    <TD id="itemc" onclick="desc.innerText='Description of Item C.'">Item C</TD>
    </TR>
    </TABLE>
    <DIV id="desc">((Empty))</DIV>
    Sorry if I took up anyone's time only to fix things myself, but I'm not some lazy jerk who expects you to do everything for me. I'll make an honest attempt to figure things out while I wait.

  3. #3
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Onclick Alterations ((.innertext bug?))

    I am glad you found the solution. Just as important , thanks for posting it here

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting



Tags for this Thread