In Progress

Fix existing JavaScript (code included)

Hi there. We need some help with a JavaScript I've started, but I just started learning JS so I wasn't able to complete the script myself.

What we want the JavaScript to do is to show/hide table rows. The problem is that we want to hide two different types of table rows, and that's where the problem occurs...

We can't really disclose the real tables and rows, but think of it like the following:

You have a table with a lot of rows (three cells) about cars:

Car Name - Model - Price

There is also a checkbox in front of every row so people can check off what cars they already have, and a script (we have already created the script, so we don't need that) stores that in the database. When the page is loaded, all rows that the user has marked, will be tagged with <tr title="car">, and the link:

<a href="javascript:toggle('aa');">Show/hide A</a> , will show/hide all those cars.

But also visualise that the script is made to mark every car that is of the make Mercedes with <tr id="mercedes">. The link:

<a href="javascript:toggle('bb');">Show/hide B</a> , will show/hide every car of the model Mercedes.

The problem:

When a user selects a Mercedes as a car he already has, the table row code becomes:

<tr title="car" id="mercedes">

Both links works excellent one at the time, but not if the user first tries to click link A (show/hide all his cars), than link B (show/hide all Mercedes cars), and than click link A again.

What we also would want is to replace the:

$('aa').setHTML(''); code, so we don't have to use the mootools library (only using it for this purpose).

Current Code:

function toggle(attr) {

tr=[url removed, login to view]('tr')

var j = 0;

var k = 0;

for (i=0;i<[url removed, login to view];i++){

if (tr[i].getAttribute(attr)){

if (tr[i].style.display=='none' ) {

tr[i].[url removed, login to view] = '';

if (attr=='title')

$('aa').setHTML('Status: <font color="red"><b>Visible</b></font>');

if (attr=='id')

$('bb').setHTML('Status: <font color="red"><b>Visible</b></font>');

}

else {

tr[i].[url removed, login to view] = 'none';

if (attr=='title' && attr=='id') {

j++;

k++;

}

if (attr=='title') {

j++;

}

if (attr=='id') {

k++;

}

$('aa').setHTML('Status: <font color="red"><b>' + (j/2) + ' hidden</b></font>');

$('bb').setHTML('Status: <font color="red"><b>' + (k/2) + ' hidden</b></font>');

}

}

}

}

Skills: Javascript

See more: javascript fixer, fix javascript code, javascript code fixer, javascript code fix, no code, mark hide, learning code, javascript code library, id to code, fix page, fix it for you, fix help, first code, & code, cars using, car id, b j's, bb&t, bb & t, bb t, bb and t, code fix javascript, javascript showhidden table fix, toggle jquery hide table rows, javascript fix code

About the Employer:
( 2 reviews ) Narvik, Norway

Project ID: #210897

Awarded to:

soner

Ready to work with you. Please contact.

$30 USD in 1 day
(20 Reviews)
7.3

17 freelancers are bidding on average $36 for this job

lsweb

Hello. Please check your PM. Thanks.

$30 USD in 0 days
(79 Reviews)
6.7
Georgia

Ready to help you.

$30 USD in 1 day
(26 Reviews)
6.6
muquaddim

Can do it now.

$30 USD in 0 days
(14 Reviews)
5.0
iSandu

Hi. Please see PM

$30 USD in 1 day
(17 Reviews)
4.7
bdsources

I can fix your script. In fact i can make it cross browser compliant with jQuery Library leaving no chance of error on different browsers. Thanks.

$50 USD in 1 day
(13 Reviews)
4.6
expertMan

I can do it.

$30 USD in 1 day
(9 Reviews)
4.4
RaduBar7

I can create a function that does what you want in any browser without any problems.

$30 USD in 1 day
(1 Review)
1.2
swQuantum

Expert help here. Lets begin

$30 USD in 0 days
(0 Reviews)
1.0
yk2004

i fix your script,have simple, working-solution.

$30 USD in 0 days
(0 Reviews)
0.0
yogeshchandani

hello sir, i can very well do this using javascript ..

$30 USD in 1 day
(0 Reviews)
0.0
apppvaa

ready to work after discuss with you....

$30 USD in 1 day
(0 Reviews)
0.0
endrec

I can provide an excellent solution for your problem. Please contact me.

$30 USD in 1 day
(0 Reviews)
0.0
vpolkhovski

Not a problem, I'm guru in client-side solutions for corporate business. First I'll made a script. Then you'll pay.

$30 USD in 1 day
(0 Reviews)
0.0
clopez

Hi. Let me do this for you! Besides, i can teach you some awesome librarys for js that can really take js to another level.. It's your chance to learn Count me in for this project. Regards

$30 USD in 1 day
(0 Reviews)
0.0
krishnakalyank

We can fix this issue. Also we can provide an alternative approach for you requirement if needed. The main intention would be show / hide the choices of user. We can discuss the approach or fix once things are finalize More

$50 USD in 1 day
(0 Reviews)
0.0
alexmario

Hello, redy to start for your fixings.

$30 USD in 1 day
(0 Reviews)
2.0
farhansajid

Its not a difficult task.

$100 USD in 0 days
(0 Reviews)
0.0