Thank you all!! After playing around with it some more, and practicing some
suggestions, I forgot how I got it to work in the first place =( !!! But, I
do understand now, what was said. Too many things can go wrong. So, thanks.
And thanks for the links Chris.
On Tue, Dec 9, 2008 at 11:45 AM, Chris
On Tue, Dec 9, 2008 at 10:27 AM, Brett Patterson
<[EMAIL PROTECTED]> wrote:
> To All,
>
> I was playing around with a page where I found out that just about
> everything that I wanted to do I had to use:
>
> function namedFunction(layer)
> {
> var whatever = document.getElementById(layer);
> //
> Is not acceptable to put event handlers like onhover and onclick
> in an HTML page? Sorry, but I am still learning JavaScript.
Not if you want to do things the Proper Way :0) The term for keeping JavaScript
out of the HTML page is "Unobtrusive JavaScript", and we do it for the same
reasons we
Say you had another method on the page like this:
function somethingElseOnClick() {
identifier = "cheese";
}
When this function is called, your identifier variable has been overwritten,
so when your hover method comes to access it, it's not the right value any
more.
With regards to the unobtru
Hi Steve,
How could another method change the element the identifier variable is
pointing at? I thought that that could only occur if I changed the id
attribute or the variable itself, or the argument (here
namedFunction('timer')) where timer is the argument?
Hi Chris,
Is not acceptable to put e
Hi Brett,
The problem isn't this:
> var whatever = document.getElementById(layer);
I's this:
> onhover="namedFunction('timer')
What you're doing is mixing JavaScript in the HTML of the page. What you should
do is use a "listener" on your link to see when it is hovered over. This code
uses th
Hi Brett,
Your problem here would be around the usage of the identifier variable. What
if another method changed what element the identifier pointed at?
In this case, you'd be better off redeclaring the getElement selector to
patch this security risk.
Steve
2008/12/9 Brett Patterson <[EMAIL PROT
To All,
I was playing around with a page where I found out that just about
everything that I wanted to do I had to use:
function namedFunction(layer)
{
var whatever = document.getElementById(layer);
* // other code here.*
}
And I got really annoyed at having to either copy and paste or retype