wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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
 
 
subject: dynamically insert row with focus next
 
Similar Threads
resultset is not working properly
JavaScript Form Validation Issue
iframe in struts? help me out...
deleteing rows and storing row(text box) values in javascript
Javascript dynamically add rows ,element calling javascript function/applying style for element