You can do almost what you want if you find the right functions available in physlet library and javascript codes.

Check out

http://webphysics.davidson.edu/Applets/PhysletsDoc/index.html for information about physlet available functions.

You have the following javascript physlet code:

id1=fkh.addObject("coil","x=0,y=0,i=1,r=0.1");id2=fkh.addObject("coil","x=0.02,y=0,i=1,r=0.1");id3=fkh.addObject("coil","x=0.04,y=0,i=1,r=0.1");id4=fkh.addObject("coil","x=0.06,y=0,i=1,r=0.1");id5=fkh.addObject("coil","x=0.08,y=0,i=1,r=0.1");id6=fkh.addObject("coil","x=0.1,y=0,i=1,r=0.1");id7=fkh.addObject("coil","x=0.12,y=0,i=1,r=0.1");id8=fkh.addObject("coil","x=0.14,y=0,i=1,r=0.1");id9=fkh.addObject("coil","x=0.16,y=0,i=1,r=0.1");id10=fkh.addObject("coil","x=0.2,y=0,i=1,r=0.1");id11=fkh.addObject("coil","x=0.18,y=0,i=1,r=0.1");id12=fkh.addObject("coil","x=0.22,y=0,i=1,r=0.1");id13=fkh.addObject("coil","x=0.24,y=0,i=1,r=0.1");id14=fkh.addObject("coil","x=0.24,y=0,i=1,r=0.1");id15=fkh.addObject("coil","x=0.26,y=0,i=1,r=0.1");id16=fkh.addObject("coil","x=0.28,y=0,i=1,r=0.1");id17=fkh.addObject("coil","x=0.28,y=0,i=1,r=0.1");id18=fkh.addObject("coil","x=0.3,y=0,i=1,r=0.1");

where id1,id2,...id18 are integer variables. from the above web page you can find

double getX(int id): Get the x position of an object.

boolean setX(int id, double x) Change the x of an object.

So if you only set id1 dragable with code

fkh.setDragable(id1,true);

Then, you can use x1=getX(id1); to get x coordinate for the dragged coil

then you can add

setX(id2,x1+=dx);

setX(id3,x1+=dx);

....

to set all the coils.

If you want user to drag coil in horizontal only. add the following code

setY(id1,0); // to fix y coordinate for the first coil

It will be easier if you use array object

for examples:

id=new Array(18);

x1=0;

for(i=0;i<18;i++){ // use this loop to create coils

id

*=fkh.addObject("coil","x="+x1+",y=0,i=1,r=0.1");*

x1+=0.2;

}

Then it will be easier to move all the coil together

x1=getX(id[0]); y1=getY(id[0]);

for(i=1;i<18;i++){// move all the coils (x,y) together

setX(id*,x1+=dx);*

setY(id*,y1);*

}