Logical If and "Own javascript"

  • Автор темы Автор темы Stroks
  • Дата начала Дата начала

Stroks

Client
Регистрация
09.02.2012
Сообщения
219
Реакции
14
Баллы
18
I check if a word is present in a string using javascript. I know i can do this another way, but this would make the template i am working on way to long. So I added the following string in a if block and it reports an error even in javascript tester everything is fine:

({-Variable.parse_normal_free-}.indexOf("$") != -1) && ({-Variable.Parse_normal_title-}.indexOf("$") != -1 )


Here {-Variable.parse_normal_free-} and {-Variable.Parse_normal_title-} are string variables.

After that I tried to do the same thing using "own javascipt" block and i am still getting an error.

({-Variable.parse_normal_free-}.indexOf("$") != -1) && ({-Variable.Parse_normal_title-}.indexOf("$") != -1 );


What is the problem. Can i actually use variable from ZP in the javascript block this way. Thanks.
 
If the question above is too difficult, then let me know how to assign a variable to own javascript. Lets say I have a variable {-Variable.1-} which is a string.

How to add it to javascript and find if it contains a specific string?
 
First logical expressions doesn't seem to be javascript anymore.
wanted some clarification from support http://zennolab.com/discussion/showthread.php?8873-weird-problem-with-input-boolean-variables but still waiting...
Anyway your javascript doesn't seem to be valid.
Unless value of variable {-Variable.parse_normal_free-} contains javascript variable name. But you say it's a string.

so it should be something like this:
var somevar='{-Variable.parse_normal_free-}';
(somevar.indexOf("$") != -1);

or even (note quotation marks):
"{-Variable.parse_normal_free-}".indexOf("$") != -1
 

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