Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript - Wildcards and Loops

Engaged ,
Nov 05, 2015 Nov 05, 2015

Hi

I'm a javascript newbie.

I have a slide with multiple text entry boxes and one Submit button.

When submit is clicked i execute a function - the code is in the Index file.

What i want to do now is create loops within the function to condense the code (i also want to reuse the Function on different slides).

I wrote the code out in long form - check if each text box has text, when they all have text - check to see if text is correct or not.

Now i want to see if i can condense the code using Loops.

I have two questions:

Question 1:

It it possible to use wildcards to append numbers and slide numbers to captivate variables and objects:

i.e when you use "window.(variable)" or "get" and "set" variables (getElementById, getVariableValue) ?

So can "v_teb01_slide01" be "v_teb(number)_(slidenumber)"?

Question 2:

How would i create the loops - what would the "endvalue" be?

for (i = 0; i < endvalue??; i++) {

    if ( window.v_teb01 == "" ) ,,,,,,,,,,

}

Regards

Donal.

167
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Help resources