You need to remove the plus signs after you paste it. There's 1 before and after the word script at the beginning. If you do it before then the full java script won't paste.

Step 4: A message box will open up asking you to choose the number of messages you want to spam, enter a number.

Step 5: Next, enter the text that you want to spam on your friend’s wall.

Step 6: Wait a few seconds, and refresh your page and you can see your friends wall flooded with your spam messages.

NOTE :While using this trick be aware that :1 . Your safe browsing is turned off, you are not browsing facebook on https mode.2. Spamming more than 100 messages in less than an hour will ban you for a day preventing you to spam any further wall posts.