Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Looking for some code

  1. #1
    Join Date
    Apr 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Looking for some code

    I dont know where to begin? I need someone to point me somewhere!

    I have a simple little project for school.
    I have a table 10 rows 6 columns.
    I want to put one word in each cell.
    And at the bottom a text window that adds one word clicked from each colum to make a sentence. There are 1 million variants. Which is the point of the project.

    I dont know where to begin.

    Rack

  2. #2
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    But isn't that like cheating or something? Or does it not matter???

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Policy with homework tends to be that we help, but don't do it for them.

    In this case, however, I've no idea what the OP is trying to describe.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think he wants there to be 10 rows with six columns, he also wants a word in every box, and when that box is clicked he wants a word at the bottom of the screen that the user clicks then that whole row should go disabled...

    It should result in a word at the bottom of the screen...

  5. #5
    Join Date
    Apr 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Its not homework, its just part of a school project.

    We dont care about anything going blank or anything.
    We just need to click on words and have them appear in a text box at the bottom.

    thanx again!

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    So:
    Code:
    <p onclick="document.getElementById('area').innerHTML=this.getAttribute('text')" text="My foo test">Click these words</p>
    ...
    <div id="area"></div>
    - Mike

  7. #7
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    You'll want to append the data, not assign.
    I'm tempted to expand upon this, it is not that hard...

    <p onclick="document.getElementById('area').innerHTML+=this.getAttribute('text')" text=" word">word</p>
    ...
    <div id="area"></div>
    <p onclick="document.getElementById('area').innerHTML=''">Reset</p>
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Or, the DOM method:
    Code:
    function add(element,data,append) {
      var el = document.getElementById(element);
      if (!append) {
        while (var f=el.firstChild) el.removeChild(f);
        }
      el.appendChild(document.createTextNode(data));
      }
    - Mike

  9. #9
    Join Date
    Apr 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanx everyone!

    We are the paper, we are computer illiterate.
    Or so the computer dept keeps telling us.
    But they are not smart enough to do this!

    We do not really know how to apply the code.

    I went to a project page and uploaded an example file.
    Here it is
    http://yearthatwas.com/wordgame.htm

    If some one could code that for us, boy would that be cool.
    We are at least smart enough to apply it to the larger project.
    The one million sentences generator.
    Though Jimbo here wants to make it the one million questions generator.

    I think that if you did this for us, you and others could use it for all sorts of funny things.

  10. #10
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Take a look at this page:

    http://phphost.smackum.com/dd/rack.html

    and tell me if that is what you were talking about. If so, simply copy the source code and use it as you see fit.

    Hope this helps.

    //EDIT: Tested in FF 2.0.0.1+ and IE6+ on Windows XP (home and pro).
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

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