www.webdeveloper.com
Results 1 to 3 of 3

Thread: Commands in Variables

  1. #1
    Join Date
    Feb 2007
    Posts
    9

    Commands in Variables

    Say I have a command stored in a variable:
    HTML Code:
    var aCommand = "document.form1.submit();";
    How do could I execute that command??

  2. #2
    Join Date
    Feb 2006
    Posts
    2,927
    You can use eval(aCommand), but this syntax may be better:

    var aCommand = function(){document.form1.submit()};
    aCommand();

  3. #3
    Join Date
    Feb 2007
    Posts
    9

    THANKS MrHoo!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles