*
The moose likes HTML, CSS and JavaScript and the fly likes dynamically insert row with focus next Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "dynamically insert row with focus next" Watch "dynamically insert row with focus next" New topic
Author

dynamically insert row with focus next

bharat parekh
Greenhorn

Joined: Mar 30, 2005
Posts: 4
I need help. I am using set attribute I am trying to attach event focus next. it is not working...


newInputs[1].setAttribute('name', 'statename[]');
newInputs[1].setAttribute('id','state_name_' + rowNumber);
newInputs[1].setAttribute('type','text');
newInputs[1].setAttribute('size', '25');
newInputs[1].setAttribute('disabled', 'true');
newInputs[1].setAttribute('align', 'left');

newInputs[2].setAttribute('name', 'miles[]');
newInputs[2].setAttribute('id','miles_' + rowNumber);
var m = 'miles_' + rowNumber;
newInputs[2].setAttribute('type','text');
newInputs[2].setAttribute('size', '10');
newInputs[2].setAttribute('align', 'right');
newInputs[2].setAttribute('onkeypress', "function()return focusNext(this, 'gallons_' + rowNumber, event)");

newCells[i].appendChild(newInputs[i]);
newRow.appendChild(newCells[i]);
}

myTableBody.appendChild(newRow);
}

}

[ March 30, 2005: Message edited by: bharat parekh ]
[ March 30, 2005: Message edited by: bharat parekh ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
try this....

[ March 30, 2005: Message edited by: Eric Pascarello ]
bharat parekh
Greenhorn

Joined: Mar 30, 2005
Posts: 4
No I tried before I posted to your side...

It focus to the one on the page with hard code...

is there any way I can talk to you!!!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Do you have this code available running somewhere?

what is the function focusNext?

after you add a row, type into the location bar

javascript:document.write(document.body.innerHTML);

then look at the source code, does the event caller look correct?

Eric
[ March 30, 2005: Message edited by: Eric Pascarello ]
bharat parekh
Greenhorn

Joined: Mar 30, 2005
Posts: 4
Thanks Eric,

Do you have this code available running somewhere?
--->No ! we are still on internal server.

what is the function focusNext?
--->this is Javascript function Focus next(This.form, nextfield, event);

after you add a row, type into the location bar
javascript ocument.write(document.body.innerHTML);
then look at the source code, does the event caller look correct?

---> what is location bar.

Bharat
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
address bar......
bharat parekh
Greenhorn

Joined: Mar 30, 2005
Posts: 4
when I view source then I can't see any event's attached..

bharat
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: dynamically insert row with focus next