PDA

View Full Version : Java Script Event



ramzansadiq
Nov 26th, 2009, 05:20 PM
Hi,

I have some steps to transform into JavaScript but no idea what I am doing wrong (novice with JavaScript). I hope you guys could help.

1//Set Unique ID
done at other file

2//Pass Unique ID in the URL
done at other file

3//Get FeedbyID function
var getfeedvalue= GetFeedByID("Address")

4//Access connection object of that unique feed
connection.addEventListener("getfeedvalue", FilteredUrlChangedHandler);


5// For the connection, get the value for the filteredUrl propery. (this is the url that is called when the layer is checked.)
function FilteredUrlChangedHandler(sender) {
var changevalue=sender.toString
}

6// Set the value of the UrlFormat property with the value you got from the filteredURL.
getfeedvalue=changevalue


Please let me know what I am doing wrong at step 5 or 6.

Thanks
Ram

mrhoo
Nov 27th, 2009, 06:25 AM
I can't get past step 4-

getfeedvalue appears to be a property, not an event type.

You also are not sending any argument (sender) in the listener,
unless 'sender' is the event itself, which will return 'Object' every time.

Or it would, if 'getfeedvalue' was an event type that could be listened for,
like 'load','readystatechange','focus', 'click','keypress','mouseover', etc.

Are you sure you want javascript for this?

ramzansadiq
Dec 1st, 2009, 05:54 AM
Thank you for your response. Can you give me an idea how events are controlled in Javascript.

4//Access connection object of that unique feed
connection.addEventListener("getfeedvalue", FilteredUrlChangedHandler);??

Thanks
Ram

Old Pedant
Dec 1st, 2009, 08:48 AM
It would help if you told us what your "connection" is.

What kind of object? Who defined the events for it?

Old Pedant
Dec 1st, 2009, 08:52 AM
I think I just realized what you were trying to do:


var getfeedvalue= GetFeedByID("Address")
...
connection.addEventListener("getfeedvalue", FilteredUrlChangedHandler);

If that getfeedvalue is supposed to be the same thing in those two lines, it won't work. Apparently, you were assuming/hoping that you could trigger an event by a change of the value of that variable.

Nope. Not a part of the JS object model. Not a part of the DOM, either.

So...

You will need to show more code and the *ACTUAL* code for us to help you with this.

But if I understood what you were trying, you will have to find a completely different way to tackle it.

Old Pedant
Dec 1st, 2009, 08:54 AM
LOL! And now that I understand that, I understand what MrHoo was saying, which is the same thing I'm saying. Sorry! Didn't mean to be dense.

chuajhe
Dec 1st, 2009, 08:52 PM
I accept with Javascript:
5// For the connection, get the value for the filteredUrl propery. (this is the url that is called when the layer is checked.)
function FilteredUrlChangedHandler(sender) {
var changevalue=sender.toString
}
__________________
Simulation rachat credit personnel reduit | (http://rachatcreditpersonnel.org/)Demande rachat credit personnel en ligne | (http://rachatcreditpersonnel.org/)Comparatif meilleur taux rachat credit pret personnel (http://rachatcreditpersonnel.org/)

DTD13
Dec 1st, 2009, 10:13 PM
Yes, if this is simply a URL rewrite with the ID, then get Address, Combine address and ID of address into a string and then pass in some parsable format...then you are definitely complicating things. Also, what language is the URL formed from? I mean is this a JAva/JSP or .NET app? If so...no need to use JS for this. The native scripting language provides better means of doing this.

TinyScript
Dec 2nd, 2009, 06:05 AM
getfeedvalue.addEventListener("click", FilteredUrlChangedHandler);

is this what he's after?

Kor
Dec 2nd, 2009, 09:47 AM
ramzansadiq, are you aware that the addEventListener() method won't work in Internet Explorer? There are two event registration methods. See:
http://www.quirksmode.org/js/events_advanced.html

On the other hand, addEventListener() is a method which creates and appends only "natural" events (like onclick, onload, onmouseover), not custom methods. If you want to create and trigger custom methods, you should use a constructor.

nehasenworld
Dec 2nd, 2009, 10:00 AM
Free SEO (***)toolkit.
==========
nehasenworld, please do not hijack the threads. Your post has nothing to do with the subject discussed here. Next time when you will do the same, you will be banned.
----
Kor - Client side moderator
==========