some questions on CSS and Javascript
i'm trying to get a page made to help users with finding RGB and Hexadecimal color codes to become XHTML compliant instead of HTML 4.01
i created a variant to play aroundon. i thought i found the solution, but when i switched from http://24.91.157.113/findyourdesire/colorfinder.php to http://24.91.157.113/findyourdesire/vcf.php i got javascript issues. i don't understand what in the change caused that
incase you look at this at a time the server is off (my rents have a habit of turning it off on me :x ), here's the two sets of java script (changes only; modified to stop horizontal scrolling):
working:
/* find out what was entered */
var hdp=(parent.cntrl.document.colortable.hdp.value);
var red=(parent.cntrl.document.colortable.red.value *1);
var gre=(parent.cntrl.document.colortable.green.value *1);
var blu=(parent.cntrl.document.colortable.blue.value *1);
var hred=parent.cntrl.document.colortable.red.value;
var hgre=parent.cntrl.document.colortable.green.value;
var hblu=parent.cntrl.document.colortable.blue.value;
var text="style=\"color:#ffffff\"";
var hexpat=/^[0-9A-Fa-f]+$/; // any valid hex character one or more times
var pat=/^[C-Fc-f][0-9A-Fa-f]$/; // anything lighter than bf
/* find out what was entered */
var hdp=(parent.cntrl.document.colortable.hdp.value); // which format
var red=(parent.cntrl.document.colortable.red.value *1); // numerical red
var gre=(parent.cntrl.document.colortable.green.value *1); // numerical green
var blu=(parent.cntrl.document.colortable.blue.value *1); // numerical blue
var hred=parent.cntrl.document.colortable.red.value; // hex red
var hgre=parent.cntrl.document.colortable.green.value; // hex green
var hblu=parent.cntrl.document.colortable.blue.value; // hex blue
var hexpat=/^[0-9A-Fa-f]+$/; // any valid hex character one or more times
var pat=/^[C-Fc-f][0-9A-Fa-f]$/; // anything lighter than bf
var pgstrt="<html><head><style type=\"text/css\">\nbody { background-color:#";
// start the page (static)
var text=";\ncolor:#ffffff;\n}\n"; // text color (slightly dynamic)
var clshd="</style></head><body>Color=#"; // next (static) part of the page
var endpg="</body></html>"; // end the page (static)
function writeframe(r, g, b, text){ // write to the frames;
parent.b1.document.open(); // write red
parent.b1.document.write("<html><body bgcolor=\"#"+r+"0000\" "+text+"> \n
Color=#"+r+"0000 \n </body></html>");
parent.b1.document.close();
parent.b2.document.open(); // write yellow
parent.b2.document.write("<html><body bgcolor=\"#"+r+g+"00\" "+text+"> \n
Color=#"+r+g+"00 \n </body></html>");
parent.b2.document.close();
parent.b3.document.open(); // write green
parent.b3.document.write("<html><body bgcolor=\"#00"+g+"00\" "+text+"> \n
Color=#00"+g+"00 \n </body></html>");
parent.b3.document.close();
parent.c.document.open(); // write full color
parent.c.document.write("<html><body bgcolor=\"#"+r+g+b+"\" "+text+"> \n
Color=#"+r+g+b+" \n </body></html>");
parent.c.document.close();
parent.d1.document.open(); // write magenta
parent.d1.document.write("<html><body bgcolor=\"#"+r+"00"+b+"\" "+text+"> \n
Color=#"+r+"00"+b+" \n </body></html>");
parent.d1.document.close();
parent.d2.document.open(); // write blue
parent.d2.document.write("<html><body bgcolor=\"#0000"+b+"\" "+text+"> \n
Color=#0000"+b+" \n </body></html>");
parent.d2.document.close();
parent.d3.document.open(); // write cyan
parent.d3.document.write("<html><body bgcolor=\"#00"+g+b+"\" "+text+"> \n
Color=#00"+g+b+" \n </body></html>");
parent.d3.document.close();
}
function writeframe(r, g, b, text){ // write to the frames;
parent.b1.document.open(); // write red
parent.b1.document.write(pgstrt+r+"0000"+text+clshd+r+"0000"+endpg);
parent.b1.document.close();
parent.b2.document.open(); // write yellow
parent.b2.document.write(pgstrt+r+g+"00"+text+clshd+r+g+"00"+endpg);
parent.b2.document.close();
parent.b3.document.open(); // write green
parent.b3.document.write(pgstrt+"00"+g"00"+text+clshd+"00"+g+"00"+endpg);
parent.b3.document.close();
parent.c.document.open(); // write full color
parent.c.document.write(pgstrt+r+g+b+text+clshd+r+g+b+endpg);
parent.c.document.close();
parent.d1.document.open(); // write magenta
parent.d1.document.write(pgstrt+r+"00"+b+text+clshd+r+"00"+b+endpg);
parent.d1.document.close();
parent.d2.document.open(); // write blue
parent.d2.document.write(pgstrt+"0000"+b+text+clshd+"0000"+b+endpg);
parent.d2.document.close();
parent.d3.document.open(); // write cyan
parent.d3.document.write(pgstrt+"00"+g+b+text+clshd+"00"+g+b+endpg);
parent.d3.document.close();
}
}
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
m3rajk posted this at 20:58 — 12th October 2003.
They have: 461 posts
Joined: Jul 2003
as someoen elsewhere pointed out, there's a missing +
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.