someVariable_v
2. Add a Client JavaScript Builder (Specify explicitly)
3. To access the
someVariable_v
from JavaScript, just specify something like:var variableName = '${Variable/someVariable_v}'
someVariable_v
someVariable_v
from JavaScript, just specify something like:var variableName = '${Variable/someVariable_v}'
<html> <html> <head> <title>Open Sesame</title> <script> function openSesame() { var newWindow = window.open('javascript:void(0)','_blank'); var contents = '<html><head></head><body><form id="submitForm" method="post" action="http://mydomain.com/postdata"><input name="token" value="abcde12345678" type="hidden" /></form></body></html>'; newWindow.document.write(contents); newWindow.document.close(); newWindow.document.getElementById("submitForm").submit(); } </script> </head> <body> <h1>Open Sesame</h1> <a href="javascript:openSesame()" />Open Sesame</a> </body> </html>
<html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <style> //insert css here </style> <script type="text/javascript"> //insert javascript here function submitQuery() { //insert logic here } </script> </head> <body> <h1>Tweet Counter</h1> <form action="#" method="POST" onsubmit="submitQuery(); return false;"> Tweet number: <input type="text" id="n" name="n" value="114" /><br /> Search: <input type="text" id="q" name="q" value="#onesmallactforPH" /><br /> Since(yyyy-mm-dd): <input type="text" id="since" name="since" value="2012-06-12" /><br /> Except user: <input type="text" id="except_user" name="except_user" value="TALKtvPhil" /><br /> <input type="submit" name="submit" value="Go!" /> </form> <div id="total-count">Total count: </div> <div id="invocations"></div> <div id="tweets"></div> </body> </html>
var endpoint = 'http://search.twitter.com/search.json'; var callback = '&callback=?'; var totalCount = 0; var pageIndex = 0; var count = 0; var dataCollection = new Array(); var results = new Array(); function getTweets(url) { $.getJSON(url, function(data) { dataCollection[pageIndex] = data; if(data != '' && data.results.length !=0) { getNextPage(data.next_page, data.results.length); } } ); } function getNextPage(nextPage, count) { totalCount += count; pageIndex += 1; $('#total-count').html('Total count: ' + totalCount); if (typeof nextPage != 'undefined') { var url = endpoint + nextPage + callback; getTweets(url); } else { showTweets(); } } function showTweets() { var n = $('#n').val(); for (var i = dataCollection.length -1; i >= 0; i--) { for (var t = dataCollection[i].results.length -1; t >= 0; t--) { results.push(dataCollection[i].results[t]) } } for(var t=n-1; t >= 0; t--) { $('#tweets').append('<div class="tweet">' + (t+1) + '<div class="tweet-user"><img class="tweet-img" src="' + results[t].profile_image_url + '" />' + results[t].from_user + '</div><div class="tweet-text">' + results[t].text + '"</div><div class="tweet-date">' + results[t].created_at + '</div></div>'); } } function submitQuery() { totalCount = 0; pageIndex = 0; dataCollection = new Array(); count =0; results = new Array(); $('#tweets').html(''); $('#total-count').html('Total count: ' + totalCount); var query = escape($('#q').val()); var since = escape(' since:' + $('#since').val()); var except_user = escape(' -from:' + $('#except_user').val()); var nextPage = '?q='+ query + since + except_user + '&page=1&rpp=100'; var url = endpoint + nextPage + callback; getTweets(url); }
.tweet { margin: 10px; padding: 10px; border: 1px solid black; width: 300px; } .tweet, .tweet-user, .tweet-date, tweet-text { display:block; }Here's the full code. Copy the code, paste in a Text editor (notepad), save as filename.html, open the file in a browser and have fun. Important reminder: there are no validation checks in this code so you might encounter errors if you decide to place garbage in your input.
<html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <style> .tweet { margin: 10px; padding: 10px; border: 1px solid black; width: 300px; } .tweet, .tweet-user, .tweet-date, tweet-text { display:block; } </style> <script type="text/javascript"> var endpoint = 'http://search.twitter.com/search.json'; var callback = '&callback=?'; var totalCount = 0; var pageIndex = 0; var count = 0; var dataCollection = new Array(); var results = new Array(); function getTweets(url) { $.getJSON(url, function(data) { dataCollection[pageIndex] = data; if(data != '' && data.results.length !=0) { getNextPage(data.next_page, data.results.length); } } ); } function getNextPage(nextPage, count) { totalCount += count; pageIndex += 1; $('#total-count').html('Total count: ' + totalCount); if (typeof nextPage != 'undefined') { var url = endpoint + nextPage + callback; getTweets(url); } else { showTweets(); } } function showTweets() { var n = $('#n').val(); for (var i = dataCollection.length -1; i >= 0; i--) { for (var t = dataCollection[i].results.length -1; t >= 0; t--) { results.push(dataCollection[i].results[t]) } } for(var t=n-1; t >= 0; t--) { $('#tweets').append('<div class="tweet">' + (t+1) + '<div class="tweet-user"><img class="tweet-img" src="' + results[t].profile_image_url + '" />' + results[t].from_user + '</div><div class="tweet-text">' + results[t].text + '"</div><div class="tweet-date">' + results[t].created_at + '</div></div>'); } } function submitQuery() { totalCount = 0; pageIndex = 0; dataCollection = new Array(); count =0; results = new Array(); $('#tweets').html(''); $('#total-count').html('Total count: ' + totalCount); var query = escape($('#q').val()); var since = escape(' since:' + $('#since').val()); var except_user = escape(' -from:' + $('#except_user').val()); var nextPage = '?q='+ query + since + except_user + '&page=1&rpp=100'; var url = endpoint + nextPage + callback; getTweets(url); } </script> </head> <body> <h1>Tweet Counter</h1> <form action="#" method="POST" onsubmit="submitQuery(); return false;"> Tweet number: <input type="text" id="n" name="n" value="114" /><br /> Search: <input type="text" id="q" name="q" value="#onesmallactforPH" /><br /> Since(yyyy-mm-dd): <input type="text" id="since" name="since" value="2012-06-12" /><br /> Except user: <input type="text" id="except_user" name="except_user" value="TALKtvPhil" /><br /> <input type="submit" name="submit" value="Go!" /> </form> <div id="total-count">Total count: </div> <div id="invocations"></div> <div id="tweets"></div> </body> </html>
function submitForm() { document.myForm.submit(); } function delaySubmit() { setTimeout("submitForm()", 2000); //2000 is the time delay in milliseconds }here's your form code:
<form name="myForm"><input type="text" name="myTextBox" /> <input type="button" name="submitButton" value="Delayed Submit" onclick="delaySubmit()" /> </form>here's the actual: