.onchange Event Handling Help GRRR!
Ok, I started a new job with a computer sales company. This company uses flashecom for its web service (no idea why they just didnt have the programmer they had develop their site). Anyway, this web template hosting does not give complete access through coding.
When I started I had to sift through the old programmers code, because he left NOOOO documentation AHH!
This is the question, does the .onchange event handling have to be triggered in some way to work?
SCENARIO:
Web page with a bunch of select objects, none of which have onchange events already built.
<select name="asdasd">
<option value="1">option1</option>
<option value="2">option2</option>
</select>
These are all over the page.
The old programmer decided to over-ride this so he can add dynamic images depending on the value, by doing this.
<script language="javascript">
var SelectItems = document.body.getElementsByTagName('select');
for (var i=0; i < SelectItems.length; i++)
{
SelectItems[i].onchange = "javascript:optionSelected(this)";
}
</script>
Later in the code is the optionSelected(elmnt) function that does the obvious image swapping code. I can create that image swapping stuff, but my problem is, when writing my own code, I practically used the same code, but it does not work for me. I changed the for loop inner code to just a simple:
alert(SelectItems[i].name);
Now this does present me with the names of the select objects, but the onchange event does not work for me, although it does for his code. I have also tried .onChange, and nothing happens still. There is no error, but nothing happens.
I was wondering if there was some sort of trigger that must be activated. What I mean by this, is like, if you wanted to return the value of an items left position.
var obj = getElementById('item_chosen');
alert(obj.style.left);
This will not work unless when you created the object you used:
<table style="position:absolute;left=1px;top:1px;">
I hope someone can understand my problem will all the junk i've typed lol, please help! THis is frustrating me (><)
|