Client script in a web form for a child table

I am trying to write a logic to calculate the rate and qty in a child table. DocType is referenced in a Web Form. So the client script has to be on a Web Form. Please help. Thank you in advance.