Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:04:37+00:00 2026-05-13T09:04:37+00:00

I was looking at this question and saw the reference to the iPhone game

  • 0

I was looking at this question and saw the reference to the iPhone game where you drag across the screen selecting letters as you go.

I was curious to see an implimentation of this in Javascript using tables. So you’d drag the mouse over each cell they would then become highlighted.

I’m not sure what the best method would be but I hope someone has a go. Someone attempted it here, but it doesn’t really work.

alt text alt text

Thank Cacoo for the sexy diagrams. It’s like an online visio, really nice. Check it out 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:04:38+00:00Added an answer on May 13, 2026 at 9:04 am

    Here’s a working prototype: http://jsfiddle.net/few5E/ Using jQuery for DOM hooking, but could easily be implemented with another framework.

    A few relevant facts:

    • The mousedown event of the table cells is hooked to track the actual click. This event is stopped, so that text selection is hindered. Also binding ontextselect for the same effect in IE.
    • The mouseover event will toggle the highlighted class for the cell
    • The mouseout event is hooked on document. This is to ensure that it always runs. If the mouseup event was hooked on the table cell, it would not trigger if you released the mouse key with the mouse outside of the table. This state is tracked in isMouseDown.

    Full source code for reference:

    $(function () {
      var isMouseDown = false,
        isHighlighted;
      $("#our_table td")
        .mousedown(function () {
          isMouseDown = true;
          $(this).toggleClass("highlighted");
          isHighlighted = $(this).hasClass("highlighted");
          return false; // prevent text selection
        })
        .mouseover(function () {
          if (isMouseDown) {
            $(this).toggleClass("highlighted", isHighlighted);
          }
        })
        .bind("selectstart", function () {
          return false;
        })
    
      $(document)
        .mouseup(function () {
          isMouseDown = false;
        });
    });
    table td {
      width:100px;
      height:100px;
      text-align:center;
      vertical-align:middle;
      background-color:#ccc;
      border:1px solid #fff;
    }
    
    table td.highlighted {
      background-color:#999;
    }
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <table cellpadding="0" cellspacing="0" id="our_table">
      <tr>
        <td>a</td>
        <td>b</td>
        <td>c</td>
      </tr>
      <tr>
        <td>d</td>
        <td>e</td>
        <td>f</td>
      </tr>
      <tr>
        <td>g</td>
        <td>h</td>
        <td>i</td>
      </tr>
    </table>

    Update: http://jsfiddle.net/Brv6J/ a slightly different version – the highlighted state will only change when you release and click again.

    Update 2: http://jsfiddle.net/Brv6J/3/ – binding onselectstart so that text is not selected in IE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking at this question: Add additional data to a Highcharts series for
I was looking at this question. Basically having a leading zero causes the number
I just finished looking at this question: https://stackoverflow.com/questions/753122/which-cloud-computing-platform-should-i-choose But, I am not certain what
Thanks for looking at this question. I wanted to know how can I use
I was looking at this question: How to remove duplicate elements from an xml
and thanks for looking at this question. I am porting a Linux (2.6.37) driver
Looking in this StackOverflow question it uses the following to send emails: System.Net.Mail.SmtpClient Is
Hi and thanks for looking at this newbi question. I have looked for anykind
This question is about the public key that every .NET assembly has AFAIK (looking
While looking up the answer to this question: Why is an out parameter not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.