Click to See Complete Forum and Search --> : split('') problems???????


Zero-x252
08-07-2003, 01:23 PM
Ok I have somehow crewed this up...
I meant for this script to display a font and most of the letters for it. but as we all know fonts are in the windows directory which means I would have to split the path by \ and then split the length-1 by . and use the split var[0] or var[1] im not sure but this code dont seem to work:
function fontwrite(){
var the_script = "<script src=fontwrite.js></script>"
var the_font = the_ff.value
var seper = the_font.split('.')
var seper2 = seper.split('\')
var the_fw = seper2[seper2.length-1]'
var the_sol = the_fw
var writer = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_-+=[]{}abcdefghijklmnopqrstuvwxyz;><.,/\?"
var the_solution = '<font face="' + the_sol + '">' + writer + '</font>'
if (the_font != "")
{
top.document.disp.document.open();
top.document.disp.document.writeln(the_solution + '<link rel=StyleSheet type=text/css href=the_style.css>');
top.document.disp.document.close();
}
}
here is the main document:
<html>
<!-- Generated by AceHTML Freeware http://freeware.acehtml.com -->
<!-- Creation date: 8/7/03 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="legofrk234@aol.com">
<meta name="generator" content="AceHTML 5 Freeware">
<script language="JavaScript" src="fontwrite.js"></script>
<link rel="StyleSheet" type="text/css" href="the_style.css">
</head>
<body>
<table name="the_disp" width="100%" height="100%">
<tr>
<td bgcolor="white"><iframe frameborder="0" framespacing="0"border="0" width="100%" name="disp" src="about:NO FONT<br> To get a font right click it in the browse window and select properties type in its MS-DOS name with the file extension (ex: arial.ttf).<link rel=StyleSheet type=text/css href=the_style.css>"></iframe></td>
</tr>
<tr>
<td bgcolor="white" name="choose" height="20" >
<input name="the_ff" type="file" onChange="fontwrite()" value="Choose Font:">
</td>
</tr>
</td>
</body>
</html>

Exuro
08-07-2003, 02:17 PM
Sorry, but I don't think this script is going to work. It's just because you're dealing with Font files... You see, the name of the font usually isn't the same name as that of the actual font file... Also, at least for me, there seemed to be a problem with selecting a file in the Fonts folder with the File input object... So, this method of getting the name of a font through a File input field probably isn't going to work...

Zero-x252
08-07-2003, 02:38 PM
Exactly except for the fact that i have instructions for the user to use the MS-DOS name of the file instead of the file-name itself DOS calls the font-files from the programs definition and therefore the definition is just the regular name DOS uses that to call the actual file so i just tell my users to right-click and click properties...:cool:

Exuro
08-07-2003, 03:08 PM
If they're going to have to right-click and hit Properties and everything, you might as well just have them type the font name into a Text input, right?

Zero-x252
08-07-2003, 05:39 PM
True very very true...:rolleyes: