In HTML when an item is clicked the JavaScript connected to the item can reference the item with the keyword "this". This way the script can change properties of an item with this.propertyName = ...
I am looking to use a single server side script (written in JavaScript) in a similar manner. I have 4 hyperlink controls, when a control is clicked I need to change the colour of that control (toggle between 2 colours).
The question is how do I reference the clicked control in the server-side script?
Referencing the Control that has been clicked (Serverside)
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 94
- Joined: Fri Sep 14, 2007 12:18 pm
- Location: The Netherlands
- Contact:
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You use event.owner which returns the object where the event is configured - this will be a Control, Page or the Form itself. If it's a control you can then invoke any supported method e.g. for a Button Control:
Code: Select all
event.owner.setBackgroundColor("red");
0 x
-
- Ebase User
- Posts: 94
- Joined: Fri Sep 14, 2007 12:18 pm
- Location: The Netherlands
- Contact:
Who is online
Users browsing this forum: No registered users and 7 guests