Jump to content
UBot Underground

Js Returned Value As Command Parameter In Ui Html Panel?


Recommended Posts

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? :D

Link to post
Share on other sites

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)
}
Link to post
Share on other sites

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

Link to post
Share on other sites

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. :D

Link to post
Share on other sites
  • 3 weeks later...

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...