Solved

need code:how to make a seat plan by javascript

Posted on 2000-04-13
9
738 Views
Last Modified: 2012-05-04
Dear all,

    Do anyone have the sample code how to make a seat plan by javascript?Thanks!
0
Comment
Question by:hpchong7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 2712830
define seatplan
0
 
LVL 2

Author Comment

by:hpchong7
ID: 2712905
Seat Plan:
A  9*9 square.When mouse enter one square,its color would be highlighted(I know using onmouseover)Then After user click on it,A char  "*" would be display on the square and the seat number can be obtained (for update the database)and other user can no longer choose it.

Thanks!
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2713269
for both IE and Netscape or just IE? If it's just IE I can make it really fast...well, half an hour
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:hpchong7
ID: 2714374
It would be better for both IE and Netscape.Anyway,if you know of code of just IE,that's also okay.May you teach me how to make for Netscape?What's the difficulties?If I raised to 20 marks,would you also help me to make the version for Netscape?
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 2714981
10 points isn't much, 20 points isn't much either, but that doesn't matter. I'm at work right now, and to make it right now wouldn't be too nice for my boss.....I hope you can wait untill I'm at home (9 hours from now)
0
 
LVL 2

Author Comment

by:hpchong7
ID: 2715612
Adjusted points from 10 to 25
0
 
LVL 2

Author Comment

by:hpchong7
ID: 2715613
Thank you very very very very very much!You save me!I would wait for you!
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 25 total points
ID: 2717037
Hi there again. I didn't feel like writing 9 * 9 the same thing, so I leave that to you.

But the following is the code:

<script language=javascript>
<!--
    var SeatTaken = new Array();
    for(x=0;x<9*9;x++)
    {
         SeatTaken[x] = 0;
    }
    var Images = new Array();
    Images[0] = new Image();
    Images[0].src = "PIXEL.jpg";
    Images[1] = new Image();
    Images[1].src = "PIXEL2.jpg";
    Images[2] = new Image();
    Images[2].src = "X.jpg";

    function MouseOver(Obj, nr)
    {
       if(SeatTaken[nr]==0)
          Obj.src = Images[0].src;
    }

    function MouseOut(Obj, nr)
    {
        if(SeatTaken[nr]==0)
           Obj.src = Images[1].src;
    }

    function Click(Obj, nr)
    {
       if(SeatTaken[nr]==0)
       {
           Obj.src = Images[2].src;
           SeatTaken[nr]=1;
       }
       else
           alert("Place has already been taken.")
    }

//-->
</script>

  <td>
       <a onmouseover="MouseOver(document.x2y1, 2)" onmouseout="MouseOut(document.x2y1, 2)" onclick="Click(document.x2y1, 2)"><img name=x2y1 src="pixel2.jpg" width=30 height=30></a>
  </td>

Some explanation.

I made a table, inside the table you have 9 rows and 9 columns.
Inside each cell you put an image to start with. You give the image a name (I thought about using x1y1, until x9y9). In the <A> tag you use the onmouseover tag with the document.x1y1 thing, AND an additional number of the place (used for reference for the Array).

The 3 images used:
pixel.jpg was a white one, wasn't showing on the white background (you casn also use a transparent gif).
pixel2.jpg was a black one to indicate over which cell / image the user was hovering.
x.jpg was a picture with a BIG X on it. To let the user specify the place he wants to take.

You should write the initialization code yourself, just like the updatestatement for tha database when the user has selected a cell.

Good luck
0
 
LVL 2

Author Comment

by:hpchong7
ID: 2730132
thank you very much!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP Web Development 6 68
disable open new tab with right mouse click in <a> tag 3 41
JSON help 8 46
hide and show spans from dropdown selection 3 37
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question