Problem Answer

Alphabetize

Mugi [Mugiwara27]
10 years ago

0

Hey everybody !

I have read all thread and see that code :
var text = $('textarea[name=text]').val();
I know I have to replace text by the name of the textareo who contains words.
But when I open the source code, I can see the name of the textarea “ answer ” but not for Words !
I’ve tried to copy/paste, but still not work.
If one there can help me ! :)

15replies
4voices
270views
Wibben
10 years ago

0

For this level you’re supposed to write your own program to alphabetize the words, and copy the alphabetized version into the answer box before the timer ends

Mugi [Mugiwara27]
10 years ago

0

Somebody said we can use the console of Chrome or Firebug in Firefox

Wibben
10 years ago

0

yes, the console process javascript code, so you can use that to write a nice program to do the level

Mugi [Mugiwara27]
10 years ago

0

Yes, but the poblem is i can’t use the textarea who contains words :/

Wibben
10 years ago

0

Write your code first in the console but don’t compile it just yet, go copy words in the textbox and then execute your code, then you can paste the words into your program

Mugi [Mugiwara27]
10 years ago

0

I’ve do a script, but still no work, what the problem with ? :

<html>  
     <head>  
         <title> Coding 1 </title>  
         <?php  
             $par = $_POST [ 'parole' ]; // getting the words from textarea  
             $p = explode( "\r\n" , $par ); // put the word from string to an array deleting "\r\n"  
             sort( $p ); // function that sort alphabeticaly an array  
             $par = implode( $par , "," ); // put the word from string to an array deleting "\r\n"  
         ?>  
     </head>  
     <body>  
         <form action= "#" method= "post">  
             <textarea name= "parole" rows= "10"> <?php echo $par; ?> </textarea> <!-- Put the result in the textarea -->  
             <br />  
             <input type= "submit"/>  
         </form/>  
     </body>  
</html>  
Wibben
10 years ago

0

Okay, so I’m not that good with php, but I want to ask how are you incorporating this with the level? because nothing in there specified the level page or anything and php does not seem to be possible in the console.

Mugi [Mugiwara27]
10 years ago

0

I’ve tried to replace word in alphabetic order but when I copy/past, not work….

Wibben
10 years ago | edited 10 years ago

0

as far as I know, php is a server side scripting language, but you’re trying to use it to access the level (if you are accessing the level at all) from the client side.
I may be completely off here with my facts but this is just what I think

Mugi [Mugiwara27]
10 years ago

0

I’m lost on that level, I don’t know what I do x)

Mugi [Mugiwara27]
10 years ago

0

Now, I have a script, i think if I have just one information, i’ll be in capacity to finish this level !

[code]
var my_textarea = $(‘textarea[name=“words”]’).first();
var my_value = $(my_textarea).val();
var my_array = my_value.split(“\n”);
my_array.sort();
my_result = my_array.toString();
prompt(“”, my_result);
[code]
I have to find the syntax so that find the words.

If anyone can helpme !:)

Aldebar4n
10 years ago

0

If you have a better look into source code of webpage you should see difference between this one and the one on youtube video :)

first one is “\n” , seems to be obsolete now

keep in mind that the string on textarea change


0

Have you ever known how your script works?

Mugi [Mugiwara27]
10 years ago

0

Aldebar4n : Ok, I’ll keep change in the script thank’s !
freewind1012 : Yes, the script do that I think :

  • Find the textarea element with all the values.
  • Save the text from the textarea into the variable my_value
  • We have to break this sting into words. Telling split the string at each new line ( there : “\n” ). This is saved in a variable called my_array
  • We have to make a Javascript sort the words, we use “ sort ”
  • Need to convert the array back into a string that we can understand
  • Display this value so we can copy it to my clipboard
Mugi [Mugiwara27]
10 years ago

0

Thank’s for help everyone, I’ve find other way.

http://www.textfixer.com/tools/alphabetize-text-words.php

Just Copy/paste :p

Discussion thread has been locked. You can no longer add new posts.
1 of 16

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss