JavaScript - Javascript Click And Focus Facebook Status Update Text Box
Hi,
I am trying to implement something like a javascript that can click and focus the Status Update Box on Facebook. Till now, I have nothing in hand that can perform the task so I thought about a javascript that can do it. I am not even a newbie to javascript but I know that it can perform various complicated tasks on client side. Can anyone here tell me how do I click the Status Update box and set it to focused by a javascript so that when I start typing the Status box receive the text ? Thanks Similar TutorialsI am wanting to allow a user to update their twitter status from my website. I was planning on using Twitter's @anywhere feature, but this was not a very friendly solution: Take over 3 seconds to load Makes 14 requests Calls jQuery twice Then I found the Twitter REST API: https://dev.twitter.com/docs/api Using OAuth, I want the user to be able to login, and then update their status using that API. I've been trying to find tutorials on this, but I haven't found any that use the REST API to update the Twitter Status. Does anyone have code for/know of a tutorial for what I'm looking for? Hi, I can't get this to work, but I'm trying to update the text into an iframe on the same page with a button, for a game I'm making, the battle messages when you attack. Please any help greatly appreciated. here is the html file with the button and onClick Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <style type="text/css"> body { background-color: black; color: gold; } </style> </head> <body> <html> <body> <script type="text/javascript"> var my_var = "Hello World!" function text2add(){ return '<font color=gold><strong>'+my_var+'</strong></font>'; } </script> <form> <form><input type="button" value="change" onClick="text2add();"/></form> Main page! Frame below. <br><br> <iframe src="iframe.html" ></iframe> </body> </html> </body> </html> and here is the iframe page code] Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <script type="text/javascript"> document.write(parent.text2add()); </script> This is my iframe </body> </html> I work at a bar in Louisiana and have been put in charge of the website. Every day (Sun-Sat) we update the main page with who is bartending that night, along with a few other edits. I don't come into the office until 2pm, Mon-Fri. I would really prefer if the website could be updated 'automatically' at like, 4am or something, every day. Instead of me struggling to figure out how I'll update it on weekends. I have to use FrontPage, so I'm limited in the types of codes I can use. But Javascript seems to work well. What I'm thinking is have an 'updates' folder with pages labeled either by weekday (sunday.html monday.html tuesday.html, etc) or by date (072410.html, 072510.html, etc). Then the main page having some code that pulls from those files. (I'd prefer the weekday setup if I have the option) Since the bar doesn't close until 2am most days, I'd rather not have it change over at exactly midnight, but I'm willing to work with that if it means I know it's being updated every day regularly. I am looking for a javascript code for this idea under this message ---------------------------------------------------------------------------------------------------------------------------------------------------- I want to create a kind of shopping website so when you click on a image or text it will add some text to a textarea,, it will include the name of item and price of an item I'm trying to set the contact form on http://gspbuzz.com/test to remove the text when a user clicks it. Any idea how I can accomplish this?
Hello everybody I have a page where I have several input text fields (the number of fields is variable), the input text fields are disable , only the first one is enable, as the user goes filling out the text fields, the next text field becomes available, each time the user fills out an input text field, the form is submitted. As I said, the number of text fields is variable, some times I have only one and other time I can have 7. I would like to create a javaScript function to put the next available text field ready to star writing, without having to click in the text field first. The id of my form is "reports" , the id of the table is,"run_params" and the id of my input texts is "inputp". I am using JSF, the HTML output generated for each field is id="reports:run_params:1:input" , the number 1 indicated that is the first input text, this number can go from 1 to 20. I have tried to create a code where I can read how many input fields I have and then create a loop that checks all of them and search for the field that is enable and empty, and put that field on focus. But so far my code doesn't work. I don't have too much experience with javaScript and I already have tried many different ideas, without success, I have not idea how to achieve this objective, because I don't know very well javascript's capabilities, so I don't know what it is possible and what it is not. Any help????!!! Thanks in advance I tried to create a new text input once the last text box gets focus. But I cant even type in them because every time it gets focus a new text input is created! I really dunno what to do. Code: <html> <head> <script type="text/javascript"> function getTB(field) { var i = document.getElementById("f1").length + 1; var cmd = "<input type=text name = "+ i + " onfocus=getTB() value = " + i + ">"; document.getElementById('f1').innerHTML = document.getElementById('f1').innerHTML + cmd; document.getElementById(i-2).focus(); } </script> </head> <body> <form id ="f1"> <input type ="text" value ="hello" name="1" onFocus ="getTB(this)"> </form> </body> </html> how to modify so not every time a new text input created when tried to type in? Hi I'm trying to write a data checking function that after it completes should return the focus to the text box that was checked and highlight everything in it IF the value was unacceptable. Here is the function: Code: <script type="text/javascript"> function chkValidity(numToCheck) { if (isNaN(numToCheck) == true || numToCheck < 0) { alert("Please enter a number greater than zero"); numToCheck.focus() numToCheck.select() return false } } </script> And here are the lines of code that would call the function: Code: <input type="text" name="numBedrooms" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaBedrooms" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="numLivAreas" size="2" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaLivAreas" size="3" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="numServAreas" size="2" maxlength="3" onblur="return chkValidity(this)" /> <input type="text" name="areaServArea" size="3" maxlength="3" onblur="return chkValidity(this)" /> What I find happens is that the data checking works and the error mesage displays, but the focus does not return to the text box. Any ideas? Regards Jenny Hi I have created the following effects on the images seen here http://techavid.com/design/test3.html . You see when you hover and then click on each image, they go from grey to color. When you click on one - the others go grey and the one clicked remains color. That's cool, but now I need the text 1st: Sun for example to display and hide along with its graphic button. The word "Sun," is a link that needs to link out to a URL so it has to be separated from the image effect code. Here code I have now.... Code: <style type="text/css" media="screen"> #wrapper { background: url('_assets/images/sun-inactive.p') no-repeat #777eee; width: 470px; margin: 0 auto; } a#sun{ background: url('_assets/images/sun-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#sun:hover, a#sun.active { background: url('_assets/images/sun.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } a#plane { background: url('_assets/images/plane-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#plane:hover, a#plane.active { background: url('_assets/images/plane.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } a#nano { background: url('_assets/images/nano-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#nano:hover, a#nano.active { background: url('_assets/images/nano.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } #popuptext { float: left; margin: -30px 0 0 0; padding: 0 0 0 0px; font-size: 11px; } #popuptext a { color: #ff6600; padding: 0 30px; } </style> </head> <body> <div id="wrapper"> <div id="navigation"> <a id="sun" href="#"></a> <a id="plane" href="#"></a> <a id="nano" href="#"></a> </div> <div style="clear:both"></div> <div id="popuptext">1st: <a href="#">Sun</a> 2nd: <a href="#">Airplane</a> 3rd: <a href="#">Nano</a> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // target each link in the navigation div $('#navigation a').click(function() { // link that you clicked clicked = $(this).attr('id'); // make sure that all the others are not active // except for the clicked one $('#navigation a').each(function() { if ($(this).attr('id') == clicked) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); // prevent the default link action return false; }); }); </script> What jquery or javascript code do I need to do this? thanks, chaser Hi I'm banging my head against this problem and I'd really appreciate some help. I think the problem is cause by my lack of understanding of how the browser (firefox 3.6.3) handles focus. A simplified version of my problem is: I've defined the function Code: function two_focus() { document.getElementById("two").blur(); alert("hello"); } then in the body I have the form with two text boxes Code: <input id="one" type="text"><input id="two" type="text" onfocus="two_focus();"> When the page is loaded and I click in the second textbox I get the alert, all well and good. I OK the alert box, but when I click on box 1, or anywhere on the page for that matter, the function is called and the alert comes up. I just don't understand why the focus is being returned to the second box when I click anywhere in the browser window. Any comments will be gratefully received. Hi there, I hope I post this in the right section. I'm trying to do a redirect using the below code: <script type="text/javascript"> window.location.href = "http://google.com" </script> FF and IE work as they should. Chrome doesn't. The request above to http://google.com, gets a 'canceled' status in Chrome browser > Development tools > "Network". I've tried several other functions: location.href = url location.replace(url) document.location = url location.assign(url) window.open(url, '_self') Same code pasted within a local html file works fine. Below is the redirect request that it's canceled by chrome: http://pastebin.com/hD36M1RG Any clues? Thanks So my mom owns a business and has a facebook page (for her business.) I want to know how to create a javascript that will make anyone who views her facebook page automatically like it. Is this illegal? Can anyone help? x em-jay x Hi all, Please keep in mind: this is the first code I have ever written -- much of it with help from this forum and the skeleton from other corners of the JS community. Thanks! But now for the problem... I'm developing am income tax calculator, and everything is going swell. Currently the user can type in their adjusted gross income (AGI), hit submit, and learn the amount of income tax they would pay, their tax rate, and their income after tax. I've played around with the events to get the submit button to work in FF, IE, Chrome and Safari -- and I've gotten the enter button to work before with some stock code, but here's the catch: when the user presses enter, i want the focus to leave the input box. I don't care where it goes (submit button, I suppose?) but i need it to leave the input field so the onfocus="clearText(this);" event can fire when they return to type in a new income. Any ideas? Thanks in advance. Code: <script language="javascript" type="text/javascript"> function TotalGrossPerYear() { var Calc = document.NetIncome; if (Calc.InputRad[0].checked) { if ((Calc.AGI.value > 500000)) { Bracket3(); } if ((Calc.AGI.value > 200000 ) && (Calc.AGI.value <= 500000)) { Bracket1(); } if ((Calc.AGI.value <= 200000)) { Bracket2(); } } else if (Calc.InputRad[1].checked) { if ((Calc.AGI.value > 1000000)) { Bracket3(); } if ((Calc.AGI.value > 400000 ) && (Calc.AGI.value <= 1000000)) { Bracket1(); } if ((Calc.AGI.value <= 400000)) { Bracket2(); } } } function Bracket1() { var Calc = document.NetIncome; if (Calc.InputRad[0].checked) { Calc.TaxableIncome.value = (parseFloat(Calc.AGI.value) - 200000) ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) * 0.05)) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } else { if (Calc.InputRad[1].checked) { Calc.TaxableIncome.value = (parseFloat(Calc.AGI.value) - 400000) ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) * .05)) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } } } function Bracket2() { var Calc = document.NetIncome; if (Calc.InputRad[0].checked) { Calc.TaxableIncome.value = 0 ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) * 0.05)) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } else { if (Calc.InputRad[1].checked) { Calc.TaxableIncome.value = 0 ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) * 0.05)) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } } } function Bracket3() { var Calc = document.NetIncome; if (Calc.InputRad[0].checked) { Calc.TaxableIncome.value = (parseFloat(Calc.AGI.value) - 200000) ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) - 300000) * 0.09) + (300000 * 0.05) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } else { if (Calc.InputRad[1].checked) { Calc.TaxableIncome.value = (parseFloat(Calc.AGI.value) - 400000) ; Calc.AmtDue.value = Math.round((parseFloat(Calc.TaxableIncome.value) - 600000) * .09) + (600000 * 0.05) ; Calc.AmtLeft.value = (parseFloat(Calc.AGI.value) - parseFloat(Calc.AmtDue.value)) ; Calc.TaxRate.value = (parseFloat(Calc.AmtDue.value) / parseFloat(Calc.AGI.value) * 100).toFixed(2) + " %"; } } } function Couple() { var Calc = document.NetIncome; Calc.AGI.value = ""; Calc.TaxableIncome.value = "--------"; Calc.AmtDue.value = "--------"; Calc.AmtLeft.value = "--------"; Calc.TaxRate.value = "--------"; } function Individual() { var Calc = document.NetIncome; Calc.AGI.value = ""; Calc.TaxableIncome.value = "--------"; Calc.AmtDue.value = "--------"; Calc.AmtLeft.value = "--------"; Calc.TaxRate.value = "--------"; } function clearText(thefield){ if (thefield.value==thefield.value) thefield.value = "" } </script> </head> and the html... Code: <body> <form name=NetIncome> <table border=5> <th align=left> <ol> <li>Select Individual or Joint filing status. <li>Enter your Adjusted Gross Income. <li>Submit to calculate. <li>Please reset after each calculation. </ol> </th> <tr> <td><font size=5><input type=radio name=InputRad value=PerHour onclick="Individual()"><u>Individual</u> <input type=radio name=InputRad value=PerYear onclick="Couple()"><u>Joint</u></font></td> </tr> <tr><td><input type=text name=AGI size=30 id="txtExamplethree" onfocus="clearText(this);" onsubmit="TotalGrossPerYear();" onblur="this.value=this.value.replace(/[^\d\.]/g, '');" value="Select filing status" maxlength="20" />Adjusted Gross Income </td></tr> <tr><td><input type=text name=TaxableIncome id="txtExampletwo" readonly="readonly" size=30 value="">Taxable Income</td></tr> <tr><td><input type=text name=AmtDue id="txtExampleone" size=30 readonly="readonly" value="">Amount Due in Taxes</font></td></tr> <tr><td><input type=text name=AmtLeft id="txtExample" size=30 readoanly="readonly" value="">Income after Tax</font></td></tr> <tr><td><input type=text name=TaxRate size=10 readonly="readonly">Tax Rate</td></tr> <tr><td align=center><input type="button" value="Submit" onfocus="TotalGrossPerYear(); formatNumber(); formatNumberone(); formatNumbertwo(); formatNumberthree();" /><input type=reset value="Reset Form"></td></tr> </table> </form> Hi All, Im looking for someone that is great with java script and facebook i have a java app right now i want to add the feature to post to friends walls and so i can change that number as well so if someone clicks on the app the script all ready post to there wall but i want it to post to 15 - 25 of there friends walls over even all friends walls as well. Need these added asap i do have some java that does this all ready just need it added to the script Thanks First time poster. so be kind Hi All, I have found a bit of shared code on the net that can be used on Facebook. The way it is used is on profiles, or groups, that extend beyond an original page. You load the page and then paste the script into the address bar (in FF and chrome) and hit enter. This then goes down and looks for the 'older post' tag and expands it every 4 seconds. When it gets to the end of the group, it does not stop, it just goes into a loop and restarts from the beginning. I am wanting help to get it to stop at the end of the first pass. This is the code: Code: javascript:function clrt(){alert('Stopped Post Load');if(f_sM){clearTimeout(f_sM);}};function showMore(){ProfileStream.getInstance().showMore();f_sM = setTimeout(showMore, 4000); xsm=document.getElementById('profile_pager_container');xsm.addEventListener('click',clrt,false)}; showMore(); I have also seen it done, with the same looping results, with this code: Code: javascript:function showMore() {ProfileStream.getInstance().showMore(); setTimeout(showMore, 4000)} showMore(); Can anyone help please? Thanks Hey guys, I have this site http://free-documentaries-online.com . If you go to any documentary page and look under the documentary you will see 'Share this documentary:' like the picture below. I was wondering if you could make all the pictures have a similar size image? facebook.jpg, twitter.jpg, linkedin.jpg, digg.jpg, stumbleupon.jpg, delicious.jpg Here is the code: Code: <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="freedocosonline">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <script src="http://www.stumbleupon.com/hostedbadge.php?s=4"></script> <a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"> <img src="http://free-documentaries-online.com/images/delicious.jpg" width="20" height="20" alt="Delicious" title="Add to Delicious!" /></a> <script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })(); </script> <a class="DiggThisButton DiggIcon"></a> <a rel="nofollow" target="_blank" href='http://www.facebook.com/sharer.php?u=http://free-documentaries-online.com/watch/index?watch=<? echo "$foldername"; ?>'> <img border="0" src="../images/facebook.jpg" width="20" height="20"></a> <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share"></script></center> Thanks in advance I have the two following code snips im working with... <script type="text/javascript"> var url=document.location.href; document.write(url) </script> & the facebook comments box code: <div class="fb-comments" data-href="url" data-num-posts="20" data-width="550" data-colorscheme="dark"></div> I for the life of me cant figure out how to get the variable "url" into the href for the FB comment box. I'd like to do this so no matter what page the complete code is placed on it knows what page to associate the box with, without individual page editing. I'm new to javascript and can generally do some research and figure out what im doig but this has me baffled :| If anyone has the answer it would be GREATLY appreciated!! Thanks in advance :) i am developing a facebook application and i have this code here which queries the user id and other information: Code: $users = $facebook->api(array('method' => 'fql.query', 'query' => "SELECT uid, last_name, pic_big FROM user WHERE uid IN( SELECT uid FROM page_fan WHERE page_id='411133928921438' AND uid IN ( SELECT uid2 FROM friend WHERE uid1 = me() ))")); I need to store the user id in an array so i can send invitation only to the users in the array generated. Code: function newInvite(){ var user_ids = ["1368246891", "1206927311", "1149862205"]; FB.ui({ method: 'apprequests', message: 'There goes the message for Penelope App users to invite their friends', to: user_ids, }); } THe user_ids must be the array which holds the user id genrated from the fql query... Help me with this... I have this script added to a facebook icon (#id) on my front page: (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); })(); window.fbAsyncInit = function() { var fbClicked = false; FB.init({appId: 'Myappid', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { if(response.session && fbClicked){ window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }); } function thFBShortCut() { FB.login(function(response) { fbClicked = true; if (response.session && response.perms && fbClicked) { window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }, {perms:'email,publish_stream'}); } function thFBLogin() { fbClicked = true; $('.popbox').fadeOut(); FB.getLoginStatus(function(response) { if(response.session && response.status == 'connected' && fbClicked) { window.location = 'http://www.mysite.com/facebookauth/?ref=/'; } }); } I want when whenever user press on facebook icon, the script should trigger facebook connect app. I added `<div id="fb-root"></div>` right after `<body <?php body_class(); ?>>`, but when I load my site I keep getting these error messages: document.getElementById("fb-root") is null and FB is not defined [Break On This Error] FB.login(function(response) { My html: <a id="facebookicon" onclick="thFBShortCut()">Login</a> |