iamddr 12 Posted April 9, 2017 Report Share Posted April 9, 2017 ui html panel("<script language=\"JavaScript\">var a =\'abc\';</script> <input class=\"button Button0 Button0input\" type=\"button\" value=\"Button\" id=\"Button0\" onclick=\"ubot.runScript(\'Button0\'+\'(\'+a.length+\')\')\" /> ",300) define Button0(#any) { alert(#any) } I tried this code and works, but when I called var a instead of a.length got error, I found when command parameter is number it worked, strings got error, any idea? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted April 9, 2017 Report Share Posted April 9, 2017 Put your name in and press the button: ui html panel("Name: <input type=\"text\" variable=\"#name\"> <input class=\"button Button0 Button0input\" type=\"button\" value=\"Button\" id=\"Button0\" onclick=\"ubot.runScript(\'Button0(#name)\')\" /> ",300) define Button0(#any) { alert(#any) } Quote Link to post Share on other sites
deliter 203 Posted April 10, 2017 Report Share Posted April 10, 2017 its got to do with a combination of JS escaping quotation marks and HTML escaping quotation marks, HInsomnia wrote a post recently enough which shows how to escape in HTML, and if you check my post in the free scripts section for asynchronous HTTP Gets it shows the JS way of escaping quotes The reason the .length works is because JS doesnt need to pass quotations since .length is a type of integer, when you wanted "abc" you need to escape things so that the string has the quotes around them Quote Link to post Share on other sites
iamddr 12 Posted April 15, 2017 Author Report Share Posted April 15, 2017 its got to do with a combination of JS escaping quotation marks and HTML escaping quotation marks, HInsomnia wrote a post recently enough which shows how to escape in HTML, and if you check my post in the free scripts section for asynchronous HTTP Gets it shows the JS way of escaping quotes The reason the .length works is because JS doesnt need to pass quotations since .length is a type of integer, when you wanted "abc" you need to escape things so that the string has the quotes around them Thank you deliter, Just check out your post and the code worked fine. I think problem of my code is escaping issue, could you help me edit my code? I kinda of green hand at js thing. Quote Link to post Share on other sites
deliter 203 Posted May 5, 2017 Report Share Posted May 5, 2017 only read this now, ask HelloInsomnia, he wrote something before for html escaping ubot characters which gave me the idea for the below code,check this code out its exactly what your doing but cant remember exactly how it works or why it works http://network.ubotstudio.com/forum/index.php/topic/20500-asynchronous-http-gets-when-logged-into-a-site-from-ubot-browser/?p=127276 You see all the backslashes, and stuff, think I also made it encodeURIComponent, so that whatever was being passed could not break the code, if that had an escaped character, then when ubot recieves it, ubot then decodes it to avoid any escaped characters Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.