1 | /* Given two linked comma-separated strings containing parameter |
2 | names and values for an applet, return the corresponding HTML */ |
3 | function commaseparated(appletpname,appletpvalue) { |
4 | var stop = appletpname.lastIndexOf(','); // last comma |
5 | if( appletpname.length <= 0 ) |
6 | stop = -2; // length is property of String object |
7 | index = -1; |
8 | var ct = 0; // this is a precaution |
9 | var jndex1 = 0; |
10 | var jndex = -1; |
11 | while( index <= stop) { // scan through commas |
12 | index1 = appletpname.indexOf(',', index+1); // next comma |
13 | if (index1 < 0 ) index1 = appletpname.length; // no more commas |
14 | ++ct; |
15 | if ( ct > 20 ) break; |
16 | jndex1 = appletpvalue.indexOf(',', jndex+1); |
17 | if ( jndex1 < 0 ) jndex1 = appletpvalue.length; |
18 | // Extract the stuff between commas |
19 | var grab1 = appletpname.substring(index+1, index1); |
20 | var grab2 = appletpvalue.substring(jndex+1, jndex1); |
21 | var tag = '<param name=' + grab1 + ' value="' + grab2 + '">'; |
22 | top.document.writeln(tag); |
23 | index = index1; |
24 | jndex = jndex1; |
25 | } |
26 | } |