Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

need code:how to make a seat plan by javascript

Posted on 2000-04-13
9
Medium Priority
?
770 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
  • 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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

782 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