Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
JavaScript i novi row

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
boby-s



Joined: 10 Apr 2004
Posts: 222
Location: Samobor< >Zagreb

PostPosted: 17.02.2007 19:10    Post subject: JavaScript i novi row Add user to your forum ignore list Reply with quote

Htio bih javascriptom dodati novi row u tablici, te sam pokušao ovom skriptom
Code:

function dodaj(id)
{
   var tab = document.getElementById(\'unos\');
   var root=tab.getElementsByTagName(\'tr\')[1].parentNode;//the TBODY
   var clone=tab.getElementsByTagName(\'tr\')[1].cloneNode(true);//the clone of the first row

root.appendChild(clone);//appends the clone
}


problem je u tome što ona kopira prvi row tablice u kojemu su mi input-fieldovi, ali i sa svim trenutnim vrijenostima koje su upisane.

Kako bi mogao izbrisati te vrijednost, znači da mi napravi novi row sa inputima koji su PRAZNI.

Hvala puno, mučim se već par sati s ovim...aaaaa Confused
Back to top
View user's profile Send private message
carr



Joined: 13 Nov 2003
Posts: 1397
Location: Karlovac

PostPosted: 18.02.2007 12:49    Post subject: Add user to your forum ignore list Reply with quote

Code:
   var inputs = clone.getElementsByTagName('input');
   for(var i=0;i<inputs.length;i++)
      inputs[i].value='';

ovaj kod bi ti trebao iz ovog nodea kojeg kloniras (a zove se "clone") pocistiti sve inputove, ako tipa text...

jedino ovaj tvoj kod mi nije bas najjasniji, ali dobro ako tebi radi.

_________________
Bolje biti malo lud, nego malo pametan.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group