Results 1 to 3 of 3

Thread: JavaScript for loop won't work

  1. #1
    Join Date
    Jul 2009
    Posts
    74
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question JavaScript for loop won't work

    The following code results in the error
    Unexpected token `for'

    I'm not a JavaScript expert, but it looks valid to me:

    Qt Code:
    1. for (i=1;i<=10;i++)
    2. {
    3. // Do something
    4. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: JavaScript for loop won't work

    Is this the whole script?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2009
    Posts
    74
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: JavaScript for loop won't work

    My bad. From what I've heard on the DevDays, I just assumed that I could mix JavaScript and QML as I wanted. Wrapping it with a function does the trick.

Similar Threads

  1. Replies: 3
    Last Post: 10th June 2010, 09:35
  2. javascript problem
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2009, 14:40
  3. Javascript
    By ale301168 in forum Qt Programming
    Replies: 0
    Last Post: 7th September 2008, 00:23
  4. JavaScript in QTextBrowser
    By manojmka in forum Qt Programming
    Replies: 4
    Last Post: 27th December 2007, 09:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.