Dynamic code

23 views
Skip to first unread message

Jonas Thörnvall

unread,
Dec 4, 2021, 1:51:16 AM12/4/21
to
Is eval the only way to create and execute dynamic commands?
command="parent.MultiID.document.getElementById('MVOL"+track+"').value=CCvol"

eval(command);

Or is there a way to insert a string into a command?

JJ

unread,
Dec 5, 2021, 1:48:19 AM12/5/21
to
Script element injection; function instantiation; `javascript:` protocol;
and own JS interpreter.

Michael Haufe (TNO)

unread,
Dec 5, 2021, 12:20:27 PM12/5/21
to
The correct answer is that you're doing it wrong.

Use a function and not a string. Your command is a reference to that function.
Reply all
Reply to author
Forward
0 new messages