Javascript returns empty values

hubov

Новичок
Регистрация
15.07.2014
Сообщения
11
Благодарностей
0
Баллы
1
Hi,

I have a problem with own code JavaScript. It doesn't return any value in ProjectMaker...
The code is the following:
Код:
var text = {-Variable.page_text-};
var len = text.length;
var wait = Math.floor(len / 1000 + (Math.random() * 10 + 1));
if (wait < 2)
    wait = 2;
wait;
Can you tell me what is wrong?
I found a thread on this forum where an answer for value returning problem was to put at the end the variable which needs to be returned.
I also tried to put the ZP variable in '' like this: '{-Variable.page_text-}' - no effect either.

I tried the code in JavaScript tester - it worked fine (without the ZP variable, of course).

Help me!
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Код:
var text = "{-Variable.page_text-}";
 

hubov

Новичок
Регистрация
15.07.2014
Сообщения
11
Благодарностей
0
Баллы
1
also tried it, in the beginning
no result :(
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Then your string has more than 1 line and whole code will not work in this case.
 

hubov

Новичок
Регистрация
15.07.2014
Сообщения
11
Благодарностей
0
Баллы
1
In fact, that is true. The variable contains the result of HTML->Take text function. Is there any solution for that?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
Text processing - Replace
What to replace: {-String.Enter-}
with: nothing here
 

hubov

Новичок
Регистрация
15.07.2014
Сообщения
11
Благодарностей
0
Баллы
1
worked like a charm!
Thank you for help :-)
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
:az:
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)