Archive for April, 2005 Page 2 of 4



26AprDynamic Form Data Collection for manual POST operations

The following Javascript functions can be used to manually POST (or get) data using a form without worrying about what (or how many) elements are in your <form>.

It (ab-)uses “XMLHttpRequest” for the POST part.
Code:

function getHTML(serverPage, objID) {
var ajax=false;
/*@cc_on @*/
/*@if (@_jscript_version &amp;amp;amp;gt;= 5)
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
ajax = false;
}
}
@end @*/
if (!ajax &amp;amp;amp;amp;&amp;amp;amp;amp; typeof XMLHttpRequest!='undefined') {
ajax = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
ajax.open("GET", serverPage);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 &amp;amp;amp;amp;&amp;amp;amp;amp; ajax.status == 200) {
obj.innerHTML = (ajax.responseText);
setrelextbh();
}
}
ajax.send('');
return false;
}

function getFormResults(formID, objID) {
var ajax=false;
/*@cc_on @*/
/*@if (@_jscript_version &amp;amp;amp;gt;= 5)
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
ajax = false;
}
}
@end @*/
if (!ajax &amp;amp;amp;amp;&amp;amp;amp;amp; typeof XMLHttpRequest!='undefined') {
ajax = new XMLHttpRequest();
}
var obj = document.getElementById(objID);
var DataForm = document.getElementById(formID);
ajax.open(DataForm.method, DataForm.action);
ajax.onreadystatechange = function() {
if (ajax.readyState == 4 &amp;amp;amp;amp;&amp;amp;amp;amp; ajax.status == 200) {
obj.innerHTML = ajax.responseText;
var obj2 = document.getElementById('popupmessagetext');
if (obj2) {
alert(obj2.innerHTML);
obj2.innerHTML = '';
}
setrelextbh();
}
}
var DataString = "";
for( var i=0; i&amp;amp;amp;lt;DataForm.elements.length; i++ ){
DataForm.elements[i].disabled=true;
eName = DataForm.elements[i].name;
if( eName &amp;amp;amp;amp;&amp;amp;amp;amp; eName != '') {
if ((DataForm.elements[i].type.toLowerCase() == 'radio') || (DataForm.elements[i].type.toLowerCase() == 'checkbox')) {
if (DataForm.elements[i].checked==true) {
DataString = DataString + eName + '=' + escape(DataForm.elements[i].value).replace(new RegExp("\\x2B", "g"), "%2b");
} else if (DataForm.elements[i].type.toLowerCase() == 'checkbox') {
DataString = DataString + eName + '=0';
}
} else {
DataString = DataString + eName + '=' + escape(eval("DataForm."+eName+".value")).replace(new RegExp("\\x2B", "g"), "%2b");
}
if( i != DataForm.elements.length - 1 ) DataString = DataString + '&amp;amp;amp;amp;';
}
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.setRequestHeader("Content-Length", DataString.length);
ajax.send(DataString);
return false;

}

Usage: Simply put it in the FORM tag.

form method="post" action="?" id="commentform"onsubmit="getFormResults('commentform','content'); return false"

Of course in this case “commentform” is the ID of the form I wish to submit, and “content” is the ID of the DIV on my page that i wish to fill with the result of the POST action.

The getFormResults function assumes that the form tag has a “method” and an “action”. It takes all the values set in the form elements (textarea, input, checkbox, radio buttons,etc….) and creates a name=value& string sequence based on whatever elements if finds. It then sends that data to the form action URI (ajax.send(DataString);) and waits for the objects “onreadystatechange” event.

You can see it in action when commenting here.

21AprLOST

In an old plane they found…that crashed there long ago…Boone gets on the radio..

Boone: “Hello? We’re survivors of the crash of Oceanic flight 815, please copy!”

Radio: “Hello?! WE’RE the survivors of Oceanic flight 815!!”

How many deserted islands are there with cables coming from the ocean attached to them ?
What was the light under the hatch?
Where’s Locke?
Who (or what) was Ethan? (that guy that wasn’t on the flight manifest).
What do the numbers mean?
Who was supposed to hear them in the first place?
Does it all come down to destiny?

I cannot wait for the next episode of LOST.

Seldom have I seen a show this well written and executed. Everything about it is perfect…And i’m not exagurating. The background stories, the casting, the acting, the background music, the overall style…All perfect. Every episode is feature film quality work.

Bravo JJ Abrams

18AprRandom quotes on an image

quotes

PHP powered, of course!

Source can be found here:
/source/quotes/

17AprFunny conversation on Enterprise

T’Pol: A Vulcan science vessel surveyed the seventh planet over 50 years ago. The file states it’s an M-Class world with a flourishing ecosystem, no intelligent life.
Archer: Sounds promising.
T’Pol: They did report one distinctive feature which bears mentioning.
Archer: And that is?
T’Pol: A species of flying reptile. Some reportedly over 200 meters long. They’re also said to breath fire.(pause) There’s been lingering questions over the accuracy of this report.

Enterprise is part of the Star Trek franchise, best known for inspiring scientists, and spreading a message of tolerance and diplomacy. Its last episode will air May 13th on UPN (a.k.a The African American Channel), the network best known for replacing it with yet another reality TV show, this time based around the activities of Britney Spears. Because everybody knows, what US TV needs is less family shows about peace, tolerance and diplomacy and more reality shows about celebrities.

I’m also taking this opportunity to extend a finger to Rick Berman and Brannon Braga for running the series to the ground with their boring and predictable portrail of 9-11/war on terror/war on brown people/war on Iraq, etc, set in the 22nd century, during season three of the series.

Kudos to Manny Coto to bringing the series back to life and back on course in season four.

Sadly Paramount’s decision concerning the cancellation of the show is final. The reason given for the cancellation is “ratings”. A foolish reason since the ratings given out by the Nielsen company are as reliable as numbers of WMD’s in Iraq given by GWB.

The company that holds a monopoly on the television ratings polls in the USA claims to collect its information by tracking the watching habits of around 7000 American households.

That’s like telling how many people watch a show by,…well, you might as well guess.

“Ratings” was also the reason given for the cancellation of Futurama by the Fox Network. Futurama was replaced with a show that can only be summed up as stupid and racists,….”Banzai”.




flickr stream

California ufo / drone (taken  at Lake Tahoe using camera phone) 2 Drone 2 California ufo / drone california ufo / drone (raw picture) 5 california ufo / drone (picture taken by police) 03092007217-001 california ufo / drone (raw picture) 3 California ufo / drone

Random Gallery Image

Hanging Rick James Court The desert Tomatoes are nice The DJ A Drop Of Water On The Water on Lake Ontario

Most Recent

Bush no-country-mcain.jpg lego-mohammed.jpg mbaside.jpg

Calendar

August 2008
M T W T F S S
« Jul «-»  
 123
45678910
11121314151617
18192021222324
25262728293031