S
Stefan Mueller
I'd like to set a variable called 'FocusIsOn' if a button got the focus.
Because my button is dynamically created I do it like
xelement = document.createElement("input")
xelement.type = "button"
element.onfocus = function() {FocusIsOn = "Button_1"; alert(FocusIsOn)}
That works great. If the button gets the focus, I got a message box saying
'Button_1'.
However, if I set the variable 'FocusIsOn' dynamically (using a variable
'ButtonNumber') like
xelement = document.createElement("input")
xelement.type = "button"
element.onfocus = function() {FocusIsOn = "Button_" + ButtonNumber;
alert(FocusIsOn)}
it doesn't work like I wish it would.
I want that 'FocusIsOn' is set to 'Button_1' if 'ButtonNumber' is '1' and if
'ButtonNumber' is '99' to 'Button_99'.
However 'FocusIsOn' is effectively set to "Button_" + ButtonNumber.
That means, it doesn't matter which button I click, the message box always
says 'Button_' plus the actual value of 'ButtonNumber'.
Does anyone know how to set a variable like 'FocusIsOn' to a not modifying
string expression?
Stefan
Because my button is dynamically created I do it like
xelement = document.createElement("input")
xelement.type = "button"
element.onfocus = function() {FocusIsOn = "Button_1"; alert(FocusIsOn)}
That works great. If the button gets the focus, I got a message box saying
'Button_1'.
However, if I set the variable 'FocusIsOn' dynamically (using a variable
'ButtonNumber') like
xelement = document.createElement("input")
xelement.type = "button"
element.onfocus = function() {FocusIsOn = "Button_" + ButtonNumber;
alert(FocusIsOn)}
it doesn't work like I wish it would.
I want that 'FocusIsOn' is set to 'Button_1' if 'ButtonNumber' is '1' and if
'ButtonNumber' is '99' to 'Button_99'.
However 'FocusIsOn' is effectively set to "Button_" + ButtonNumber.
That means, it doesn't matter which button I click, the message box always
says 'Button_' plus the actual value of 'ButtonNumber'.
Does anyone know how to set a variable like 'FocusIsOn' to a not modifying
string expression?
Stefan