i have following in a string.
javascript: __doPostBack('GridWidget', 'Edit0ドル')
how can i dynamically execute this?
Marcel Korpel
21.9k6 gold badges63 silver badges80 bronze badges
-
2Lets me wonder: where does this string come from? Can't you include this in a static JS file? If it's really dynamic (e.g., user input), you're creating a huge security hole.Marcel Korpel– Marcel Korpel2010年09月04日 23:17:52 +00:00Commented Sep 4, 2010 at 23:17
2 Answers 2
Remove the "javascript:" from the front, and call eval() on the string.
answered Sep 4, 2010 at 23:14
Zach
7,9503 gold badges24 silver badges26 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
var js = "javascript: __doPostBack('GridWidget', 'Edit0ドル')".replace("javascript:","");
eval(js)
answered Sep 4, 2010 at 23:14
Paul Creasey
29k10 gold badges60 silver badges91 bronze badges
Comments
lang-js