![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello all. Please take a look at the following pseudocode: function takeAParam(param) { if (foo == bar) { var baz = object.bat; } document.getElementById(param).innerHTML = baz; } |
|
Essentially what I'm trying to do here, is make a generic function that will place specified content (from an object variable) in a specific element (identified by 'param'.) When I try this code (with the right specifications, etc.) I get "undefined" in that element. It appears to |
|
be the case where baz is not visible outside the if loop. I would know how to fix this in Java (declare the variable baz before the if loop) but that doesn't seem to help in Javascript. |
![]() |
| Thread Tools | |
| Display Modes | |
| |