\n'; } function repaint_bgcolor(form,doc){ var literal = form.literal.checked ? true : false; var mindeco = form.mindeco.checked ? true : false; var bgcolor = get_color(form.bgcolor,literal); var fgcolor = get_color(form.text,literal); var ulcolor = get_color(form.link,literal); var vlcolor = get_color(form.vlink,literal); var sample = get_value("text",form.sample); var result = html_header('Display',bgcolor,fgcolor); if(!mindeco) result += '

A Background Selector in JavaScript\n' + '
\n

\n'; result += '\n' + '\n' + '\n' + '\n' + '\n' + '
="' + bgcolor + '"
text="' + fgcolor + '" ...' + '' + sample + '' + '
link="' + ulcolor + '" ...' + '' + '' + sample + '' + '
vlink="' + vlcolor + '">...' + '' + '' + sample + '' + '
\n
\n'; if(!mindeco) result += '
\n
\n' + '[email protected]' + ' (Achille Hui)\n
\n'; result += '\n
Hosted by www.Geocities.ws

\n'; doc.close(); // just to be safe doc.open("text/html"); doc.writeln(result); doc.close(); } function repaint_picture(form,doc){ pix.setColor(0,0xffffff); pix.setColor(1,0x000000); pix.setColor(2,colordb.rgbval(get_value("text",form.bgcolor),0xffffff)); pix.setColor(3,colordb.rgbval(get_value("text",form.text), 0x000000)); pix.setColor(4,colordb.rgbval(get_value("text",form.link), 0xff0000)); pix.setColor(5,colordb.rgbval(get_value("text",form.vlink), 0x0000ff)); doc.close(); // just to be safe doc.open("message/news"); var bndy = "RandomBoundaryString" doc.write("Subject: Wow, what a great deal!\n" + "Content-Type: multipart/mixed;boundary=" + bndy + "\n" + "\n--" + bndy + "\n" + "Content-Type: image/gif\n" + "Content-Transfer-Encoding: base64\n\n"); doc.write(pix); doc.write("\n--" + bndy + "\n" + "Content-Type: text/html\n\n" + "A blessed +10 fire/water/rust-proof" + " magic/fire/cold/sleep/shock/disintegration resistant \n" + "T-shirt specially designed for roaming the dungeon.\n" + "It is extremely light and soft and you can wear it underneath your\n" + "regular armor. It is so cool that it increases\n" + "your charisma and luck.It comes with a magic\n" + "spell to change it to whatever colors you want!\n" + "For a limited time, you can have this finest piece of garment for\n" + "just 3999 gold pieces!\n" + "Order now before it is too late!\n" + "(Yendorian Express Card Accepted)\n"); doc.write("\n--" + bndy + "--\n\n"); doc.close(); } function repaint(form){ var frame = frames["display"]; if(frame != null) if(form.nethack.checked){ repaint_picture(form,frame.document); } else { repaint_bgcolor(form,frame.document); } } function set_color(form){ var frame = frames["main"]; if(frame == null) return; var main = frame.document.forms[0]; var active = get_value("radio",main.active) if(active == null) return; var value = get_value("radio",form.color); if(value == null) return; main[active].value = value; repaint(main); } function write_ctrl(){ var frame = frames['ctrl']; if(frame == null) return; var doc = frame.document; doc.close(); // just to be safe doc.open("text/html"); doc.write( html_header('Control','#123456','#ffffff') + '
\n\n\n'); var colorv = colordb.toArray(null); var i, j = colorv.length, rown = 0, coln = 0; for(i = 1; i <= j; i++){ color = colorv[i]; if((coln == 0) && (rown != 0)) doc.write('\n'); doc.write( ' \n'); if(++coln == 4){ coln = 0; rown++; } } doc.write('\n
\n' + ' ' + color + '
\n
\n\n
Hosted by www.Geocities.ws

\n'); doc.close(); } home_url = "http://www.geocities.com/~achille/"; old_url = "http://www.geocities.com/cgi-bin/nph-maps/~achille/html/hacks/bgcolor"; function jumpto(elem){ var tar = "" + get_value("select",elem); if(tar == "back"){ history.back(); } else if(tar == "home"){ location.href = home_url; } else if(tar == "old"){ location.href = old_url; } } function refresh(form){ write_ctrl(); if(form != null) repaint(form); } JavaScript Frames Demo
Hosted by www.Geocities.ws

1