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 PROTECTED]>

> 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 the
> getElementById(layer) part. So I thought about a way to not have to retype
> it (and make it cross-browser compatible) and to assign it a variable that I
> could use over and over again. I used the below:
>
> var identifier = document.getElementById(layer);
>
> function namedFunction()
>  {
>  var whatever = identifier;
>  *// other code here.*
>  }
>
> In the html part:
>
> <a onhover="namedFunction('timer')><img src="ex.jpg" alt="ex" /></a>
>
> where when you hovered over the image it dropped down a menu. Would this be
> acceptable and cross-browser compatible code?
>
> --
> Brett P.
>
> *******************************************************************
> List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
> Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
> Help: [EMAIL PROTECTED]
> *******************************************************************


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to