Hi All,
I’m trying to write by first by of javascript code from scratch (EEK!!), but in addition, I’m trying to teach myself javascript which just uses the DOM (I like a challenge :rolleyes: )
Anyway, I’ve got a little bit stuck and wondered if someone may be able to help me?
I’m trying to detect whether a [B]select
Here’s my latest attempt:
[COLOR=SlateGray]// declare the variables
[COLOR=Navy]var country = document.getElementById(“country”);
var countrylbl = document.getElementsByTagName(“label”)[0];
var region = document.getElementById(“region”);
var regionlbl = document.getElementsByTagName(“label”)[1];[COLOR=SlateGray]// set up the function
[COLOR=Navy]function setRegion()
{
[COLOR=SlateGray]// if the country has the focus
[COLOR=Navy]country.focus();
[COLOR=SlateGray]// to see if the above worked, I’ve currently just colouring the region label red
[COLOR=Navy]regionlbl.style.color=”red”;
}
I’ve also tried to use if statements, but still no joy.
Plus, all of the tutorials and examples I’ve come across all seem to use inline J/S and I’m trying to use unobtrusive J/S (with no inline stuff).
If anyone can help me get over this hurdle it would be really appreciated.
Thanks
Kessa