Re: hide() not working for me on IE

41 views
Skip to first unread message
Message has been deleted

T.J. Crowder

unread,
Jun 29, 2009, 3:23:22 AM6/29/09
to Prototype & script.aculo.us
Hi,

Which *part* doesn't work on IE? Hiding the uploading message, hiding
the whole thing when you click the link, or...?

A couple of things jumped out that may or may not be relevant:

1. I don't see that you're adding the link anywhere. You create it,
but don't add it to any element anywhere.

2. onclick handlers are quite old-fashioned. I'd suggest using
Element#observe[1] instead. Something like this:

function fileUploaded(id, filename) {
var uploadingMessage = $(id).select('span
[class~=uploadingmessage]')[0];
uploadingMessage.hide();

var a = new Element('a', {
'href' : "#alpha"
}).update("(alpha)");

a.observe('click', function(event) {
$(id).hide();
event.stop();
});
}

Again, though, you'll need to add the missing link (no pun) somewhere,
the above still doesn't have that (since I don't know where you want
to add it).

[1] http://prototypejs.org/api/element/observe

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jun 29, 7:58 am, ls86 <lavanyashas...@gmail.com> wrote:
> Hi,
>
> I am new to Prototype and here is a code snippet that works perfectly
> on firefox but doesnt work on IE for some reason.If anyone knows whats
> wrong here or can help me out in any way I'd really appreciate it.
>
>                     function fileUploaded(id, filename) {
>                         var uploadingMessage = $(id).select('span
> [class~=uploadingmessage]')[0];
>                         uploadingMessage.hide();
>
>                         var a = new Element('a', {
>                             'href' : "#alpha",
>                             onclick : "$('" + id + "').hide();return
> false;"
>                         }).update("(alpha)");
>
>                     }
>
> Thanks,
> LS
Message has been deleted

Alex McAuley

unread,
Jul 1, 2009, 4:33:08 AM7/1/09
to prototype-s...@googlegroups.com
does $(id).select('span [class~=uploadingmessage]')[0] return an(extended)/
element correctly ?



----- Original Message -----
From: "Lavanya Shastri" <lavanya...@gmail.com>
To: "Prototype & script.aculo.us" <prototype-s...@googlegroups.com>
Sent: Wednesday, July 01, 2009 8:11 AM
Subject: [Proto-Scripty] Re: hide() not working for me on IE


>
> It works if you do this:
>
> function hideElement(id){
> $(id).style.display='none';
> }
>
>
> function fileUploaded(id, filename) {
> var uploadingMessage = $(id).select('span
> [class~=uploadingmessage]')[0]
>>
>> ;
>> uploadingMessage.hide();
>>
>> var a = new Element('a', {
>> ''href' : "javascript:hideElement('" + id +
>> "');"
>> false;"
>> }).update("(alpha)");
Reply all
Reply to author
Forward
0 new messages