It must suck to be human. If I was born a human (or as you), I would have killed myself.
- Edelweiss, Sagashi-Ateru 2: Prisoners of Fate

Home » Archives » December 2007

Removing Attributes in Elements using Javascript

Wednesday, December 19, 2007

hey! here's another cool thing that i found…

getting irritated of that nasty "setting a property that has only a getter" error?

that error is caused when you tried to change something that couldn't be changed or add something that could not be added.. some element attributes are read-only and cannot be modified  such as xul's selected attribute in it's radio button implementation

<radio label="Dinner Time" name="options" id="dinner" value="4" disabled="true" selected = true /> 

if you put in your javascript something like:

if (document.getElementById('foobaz') == true) {
    document.getElementById('lunch').selected = false;
}

thinking that selected will be set to false.. well in xul there is no selected = false, it's either selected = true or no selected attribute at all

well what if you wanted to not select it you can use a javascript function called removeAttribute it removes the selected attribute so the radio button is not selected and the value will be nothing..

if (document.getElementById('foobaz') == true) {
    document.getElementById('lunch').removeAttribute('selected');
}

now, what if you want to place it to another? simply use the setAttribute function like so:

if (document.getElementById('foobaz') == true) {
        document.getElementById('lunch').removeAttribute('selected');
        document.getElementById('dinner').setAttribute('selected',true);
        }

it adds an attribute selected and assigns it as true.

now as for the values for the radiogroup maybe you can use the value function.. 

hope that helps ^^, feel free to comment if you have any questions ^^,

Posted by roiji at 11:59 am | permalink | comments[15]

At last, something worked!!!

Tuesday, December 18, 2007

Finally, the script worked with the Time Clock System UI!

Frustratingly enough I mis-declared an attribute. It is suppose to be an id but i wrote down name so for the last 2 days of the research that mis-declaration was behind all this mess!

the element that's behind all this mess…

from:

<http:serverpost
                    name
"foo"
                    targetURL="/cgi-bin/logger.pl"

                    onHTTPResponseReceived="var k = this.statusText + '\n';
                                                k += this.responseHeaders + '\n\n';
                                                k += this.responseText;
                                                outputBox.value = k;"
/>

 where it's suppose to be like:

<http:serverpost
                    id
="foo"
                    targetURL="/cgi-bin/logger.pl"

                    onHTTPResponseReceived="var k = this.statusText + '\n';
                                                k += this.responseHeaders + '\n\n';
                                                k += this.responseText;
                                                outputBox.value = k;"
/>

 I guess that's too much coffee, iced tea, ping pong, or serverpostnames…. … and maybe lack of sleep.. T_T ZZzzzz….

Post more later.. or maybe tomorrow.. ^^, 

Posted by roiji at 5:12 pm | permalink | Add comment

Nothing works…

While everybody is raving about the new girl applicant…

I received this error from google, found by bub255, confirmed thrice:

 

 

 Look at it at my Photo Album… I dunno what that's about… It's the first time I've encoutered it in my 6 years of google life…

Anyway… the script i found yesterday works but the thing is my UI does not.

T_T 

There must be wrong with the conversion  or wrong with the syntax but there's no error…

This is way too much for the capacity of ordinary OJT's to do but hey, we do real stuff here not just clerical things unlike other companies/municipalities.. …yes there are ojt's in city halls…

well gotta go…  still have brain crunching to do

T_T 

Posted by roiji at 3:36 pm | permalink | Add comment

Umbrella by Marié Digby

Monday, December 17, 2007

I'd like to share this video that I heard from sir Randy a while a go.

I love the song by Rihanna and I'm always a sucker for acoustics so I instantly liked this.

Rihanna - Umbrella (Acoustic) by Marie Digby

 a little background on her that I found on the internet..

Marié Christina Digby is a Japanese-Irish American singer-songwriter, guitarist and pianist. She is most known for her acoustic cover version of Rihanna's No. 1 hit "Umbrella", which attracted attention on YouTube in 2007. 2 months after posting the video, her version was played on radio and caught massive attention. So far, she's been on the Carson Daly show performing "Umbrella" , performed on numerous radio stations and venues and has signed up a record deal with Hollywood Records. She's currently on a tour performing all over the states to sold-out venues.Her album will be out in Feb 2008. 

there you go… i hope you like it too and support her album sometime soon if ever it hits the shelves here in the Philippines.. 

Posted by roiji at 10:07 pm | permalink | Add comment

My Radical Project update…

Finally, after 4 days of research I finally got the code that I needed…

# Process POST form variables.

if ($ENV{'REQUEST_METHOD'} eq "POST")
{
read(STDIN, $stuff, $ENV{'CONTENT_LENGTH'});
@pairs = split(/\&/, $stuff);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$$name = $value;
$$name =~ s/%(..)/chr(hex($1))/ge;
$$name =~ s/\+/ /g;
}
}

 it's called POST PROCESSING / PROCESSING POST from http://evolt.org

 now, my only problem is actually throwing the real values to the script now that I've already tried the script using serverpost testcases.

 I'll update as soon as it's finished.. and maybe I'll post some screenies!

Posted by roiji at 7:44 pm | permalink | Add comment