Okay, im having a little difficulty trying to code a #FollowFriday tweet generator for my website. My code works perfectly creating the tweet, but I want to make it so that when I hit the Submit button, it uses the text from the textarea to encode a URL and append it to the end of http://twitter.com/home?status=. For example if the text in the textbox says "#FollowFriday #FF @FATBOISLIMM" then it generates and opens this URL (http://twitter.com/home?status=%23Fo...%40FATBOISLIMM) in their browser window. Here is the code I have:
as you can see it generates the text just fine, but I dont know how to make it encode and open the URL. Please help!!Code:<script type = "text/javascript"> //www.SlapTV.net //www.LILPOTSPRODUCTIONS.com function text(t){ a = document.getElementById('statusPreview'); a.value += t; } function textCounter(field,cntfield,maxlimit) { if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); else cntfield.value = maxlimit - field.value.length; } function showtext() { var output = ""; if (document.getElementById("chk1").checked) { output = output + "#FollowFriday "; } if (document.getElementById("chk2").checked) { output = output + "#FF "; } if (document.getElementById("chk3").checked) { output = output + "@_SlapTV "; } if (document.getElementById("chk4").checked) { output = output + "@FATBOISLIMM "; } document.getElementById("statusPreview").value = output; } </script> <center> <form name="status" action="http://twitter.com/statuses/update.xml" method="POST" enctype="application/x-www-form-urlencoded"> <textarea name="statusPreview" id="statusPreview" wrap="physical" cols="55" rows="3" onKeyDown="textCounter(document.status.statusPreview,document.status.remLen2,140)" onKeyUp="textCounter(document.status.statusPreview,document.status.remLen2,140)"></textarea> <br> <input readonly type="text" name="remLen2" size="3" maxlength="3" value="140"> characters left <input type="Submit" class="Submit" value="TGIFF"> <br /><br> <input type = "checkbox" id = "chk1" onclick = "showtext()">#FollowFriday <input type = "checkbox" id = "chk2" onclick = "showtext()">#FF <br /><br /> <input type = "checkbox" id = "chk3" onclick = "showtext()">SlapTV <input type = "checkbox" id = "chk4" onclick = "showtext()">T


Reply With Quote

Bookmarks