d2jsp
Gaming and Trading Community
Gaming and Trading Community
Hourly Raffle
Ladder Slasher
Trade Finder
Photo Gallery
Forum Gold FAQ
Instant Messenger
Help and Rules
Live Streams
Account RecoveryResend Validation Email
Hello, GuestLog InRegister
d2jsp Forums > Programmer's Haven > Web Languages > Dropdown Menu To Select Table Size

Add ReplyNew TopicNew Poll
Page 1 of 1
tcl
#1 Jun 26 2012 06:53pm
Group: Members
Posts: 22,605
Joined: Sep 23 2007
Gold: 0.01
Warn: 40%
Hi :)

Would like to add a dropdown menu to my site where users can select the amount of columns and rows for inserting a table.
Should work similar to the table dropdown menu in libreoffice writer.
I know how to do the grabbing which cell has been clicked, this is already done with javascript.

What I need to know is:
How can I make it appear like on this screenshot?

I'm not sure if this is even possible, since it will have to work for any amount of rows and any amount of columns being selected (will be limited, but within the limits it has to work for any amount).
It's not a big problem if that is not possible, but it would be nice to have.

Thanks :)

This post was edited by tcl on Jun 26 2012 06:55pm
eagl3s1ght
#2 Jun 26 2012 09:42pm
Group: Members
Posts: 2,514
Joined: Nov 28 2009
Gold: 2.00
It'll be hard to do anything but do it for you unless you specify exactly where you're stuck. Or maybe that's what you are asking for - for someone to do it for you? :rolleyes:
eagl3s1ght
#3 Jun 26 2012 10:13pm
Group: Members
Posts: 2,514
Joined: Nov 28 2009
Gold: 2.00
Logically, you'll want to check row and cell number for hovered cell (which you have on your screenshot) and (for example) apply a class (.selected) for everyone of those cells.

for example, paint out the table:

Code
var w=10, h=15, sW = 7, sH = 9;
for(i = 0; i < h; i++)
  write out <tr>

  for(j = 0; j < w; j++)
     write out <td>

     if(i < sW && j < sH) class = selected


This post was edited by eagl3s1ght on Jun 26 2012 10:14pm
eagl3s1ght
#4 Jun 27 2012 03:18am
Group: Members
Posts: 2,514
Joined: Nov 28 2009
Gold: 2.00
I was bored.

tcl
#5 Jun 27 2012 05:19am
Group: Members
Posts: 22,605
Joined: Sep 23 2007
Gold: 0.01
Warn: 40%
Quote (eagl3s1ght @ 27 Jun 2012 11:18)
I was bored.

http://2.imgland.net/nuJ_MZ.png


Well, that is basically what I want, but without javascript ;)
Seems this is impossible, but I wanted to ask anyway.
Will probably do it with js since the whole editor uses js anyway.

Thanks :)
eagl3s1ght
#6 Jun 27 2012 06:00am
Group: Members
Posts: 2,514
Joined: Nov 28 2009
Gold: 2.00
Quote (tcl @ 27 Jun 2012 13:19)
Well, that is basically what I want, but without javascript ;)
Seems this is impossible, but I wanted to ask anyway.
Will probably do it with js since the whole editor uses js anyway.

Thanks :)


LOL what are you going to code it in then, xml? Your foolness is stunning.
BreakPoint
#7 Jun 27 2012 10:19am
Group: Members
Posts: 13,581
Joined: Dec 4 2009
Gold: 0.00
Quote (tcl @ Jun 27 2012 04:19am)
Well, that is basically what I want, but without javascript ;)


So... you want client-side operations that will require logic to complete, but you don't want to use a programming language to do it?

gl hf gg no re
Go Back To Web Languages Topic List
Page 1 of 1