HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 42 The String Object in JavaScript - II

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE
Secs 73.4
/* take two linked comma separated strings containing parameter names and
values for an Applet and produce correct HTML definition of them */
function commaseparated(appletpname,appletpvalue) {
var stop = appletpname.lastIndexOf(','); // last occurrence of ,
if( appletpname.length <= 0 ) stop = -2; // length is only property of string object
index = -1;
var ct = 0; // this is just a precaution
var jndex1 = 0;
var jndex = -1;
while( index <= stop) { // scan through commas
index1= appletpname.indexOf(',',index+1); // next occurrence of ,
if(index1 < 0 ) index1= appletpname.length; // no more ,'s
++ct;
if(ct >20 ) break;
jndex1 = appletpvalue.indexOf(',',jndex+1);
if(jndex1 < 0 ) jndex1= appletpvalue.length;
grab1 = appletpname.substring(index+1,index1); // Extract the stuff between commas
grab2 = appletpvalue.substring(jndex+1,jndex1);
top.document.writeln('<param name=' + grab1 + ' value="' + grab2 + '">');
index=index1;
jndex=jndex1; }
}



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat May 24 1997