Sagi 0 Posted October 27, 2012 Report Share Posted October 27, 2012 I am new to ubot 4 and working on creating two drop down in UI html panel which will be dynamically populated based on article directories browsed when account get created on one site it gets moved from one drop down to another, for this purpose i have written code as below which is including javascript for removing from one drop down and adding to another drop down, but till now i was having button to make this happen. but now i want to call javascript function when variable value gets changed like this <span variable=\"#previoussite\" fillwith=\"innertext\" class=\"style1\" document.addOption_list()></span> javascript used is <script> function addOption(selectbox,text,value )\{ var optn = document.createElement(\"OPTION\"); optn.text = text; optn.value = value; selectbox.options.add(optn);\} function removeOption(listbox,i)\{ listbox.remove(i);\} function addOption_list(i)\{var Category=document.drop_list.Category;addOption(document.drop_list.SubCat, document.drop_list.Category.value, document.drop_list.Category.value);removeOption(Category,i);\} </script> <form name=\"drop_list\"> <select name=\"Category\" multiple=\"multiple\" size=\"7\"><option value=\"www.article.com\">www.article.com</option></select> <input onclick=\"addOption_list(0)\" ;=\"\" value=\"Move >\" type=\"button\"> <select id=\"SubCat\" name=\"SubCat\" multiple=\"multiple\" size=\"7\"></select> </form> is there any way so that i can call javascript method addOption_list(0) when #previoussite has new value. Quote Link to post Share on other sites
Legend 181 Posted October 27, 2012 Report Share Posted October 27, 2012 You need to embed it in the HTML UI Panel... something like this... ui html panel("<!DOCTYPE html><html><head><script type=\"text/javascript\"><!-- function addOption(selectbox,text,value )\{var optn = document.createElement(\"OPTION\");optn.text = text;optn.value = value;selectbox.options.add(optn);\} function removeOption(listbox,i)\{listbox.remove(i);\} function addOption_list(i)\{var Category=document.drop_list.Category;addOption(document.drop_list.SubCat, document.drop_list.Category.value, document.drop_list.Category.value);removeOption(Category,i);\} //--></script></head><body> <form name=\"drop_list\"> <select name=\"Category\" multiple=\"multiple\" size=\"7\"><option value=\"www.article.com\">www.article.com</option></select> <input onclick=\"addOption_list(0)\" ;=\"\" value=\"Move >\" type=\"button\"> <select id=\"SubCat\" name=\"SubCat\" multiple=\"multiple\" size=\"7\"></select> </form> </body></html>", 150) Quote Link to post Share on other sites
Sagi 0 Posted October 27, 2012 Author Report Share Posted October 27, 2012 Sorry, I am unaware of what you are suggesting Quote Link to post Share on other sites
Legend 181 Posted October 27, 2012 Report Share Posted October 27, 2012 I updated the post for you... Quote Link to post Share on other sites
Sagi 0 Posted October 27, 2012 Author Report Share Posted October 27, 2012 ohh that not my concern, actually i am confused of way to call javascript function inside UI html panel when article directory account gets created. like when variable #previoussite gets updatedbasically i dont want to click move button each time account gets created on new Article Directory url. there should be a way that java script method gets invoked Thanks for prompt reply Duane Quote Link to post Share on other sites
Legend 181 Posted October 27, 2012 Report Share Posted October 27, 2012 Ah... that I'm not too sure about... TJ might know, maybe he'll chime in... Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted October 27, 2012 Report Share Posted October 27, 2012 In a UI HTML Panel, or window once its loaded its loaded.. Less using ajax, or jquery and calling it with an onclick function. examples of useonclick="javascript: function('value')"onclick="function('value')"onclick="return function('value')" would be added to a link like <a href="" onclick="return function('value')">Click Here</a> Button<button onclick="return function('value')">Click Here</button> 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.