Jump to content

Fun little script is not working...


clonetrooper9494

Recommended Posts

I have a scipt that would rewrite a string in huges letters made up of X's... like this:

   X X   XXX   X X

the letter H...but when I try to make a javascript, nothing happens. no errors, or anything. take a look at it...

<html><head><title></title><script>function get_text(){//7 Across, 6 Tall.la = new Array();//it was REALLY long...la[a][1]="	X	";la[a][2]="   X X   ";la[a][3]="  X   X  ";la[a][4]="  XXXXX  ";la[a][5]="  X   X  ";la[a][6]="  X   X  ";la[b][1]="  XXXX   ";la[b][2]="  X   X  ";la[b][3]="  XXXX   ";la[b][4]="  XXXX   ";la[b][5]="  X   X  ";la[b][6]="  XXXX   ";//and the font is different, but if u view it in a notepad, you can see 'B' or 'A'text = "acb";//the text of an inputta = new Array((text.length-1));for(i=0,i<text.length,i++)  {  ta[i]=text.substring(i,(i+1));  }text_storage='';for(z=1,z<text.length,z++)//this is the line  {  for(c=0,c<text.length,c++)//this is the letter	{	text_storage += la[ta[c]][z];//c could be 3, then it would be 'b'	}  }document.getElementById('text_box').value = text_storge;}</script></head><body bgcolor="#FFFFFF"><textarea id="text_box" onclick="get_text()"></textarea></body></html>

Link to comment
Share on other sites

Don't you have a debugger or an error console? Hop on the Firefox train!1. You have separated items in all your for loops with COMMAS not semi-colons.2. The variables in the first dimension of your arrays need to be defined. [a] won't work if a has no value. Change that to ['a'] or before you define the array, write a='a';3. More subtle, if la['a'] is to be an array itself, it needs to be defined as one. So: la['a'] = []; (That's JSON shorthand for la['a'] = new Array();, in case you haven't picked up on that.)4. And, in the last line of your script, you have misspelled storage. (Ouch!)Making all these changes, I have managed to get the script to print the first line of letters. Then the loops break. So your homework is to work on those loops. Good luck. And HAVE FUN!

Link to comment
Share on other sites

I have finished! thanks for all of your help. yes, I had some Looping problems, but now it works.http://clone-drone.net/home/text_to_bigtext.htmlAlso, I have to allow the user to choose the text and add in the letters M-Z... :)

Link to comment
Share on other sites

Fun code, but it doesn't work for capitals, and if you have just one capital the whole thing stops working, you should have a function to transform the input to lowercase, because high or low case the X image of the letter is the same

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...