javascript help
javascript help
- Started
- Last post
- 2 Responses
- foreign
i wrote a function to expand a div: change the height.
i originally put the onclick on the div i want to expand, like this:
javascript:expand( this, 800 )
ie: ( div, height )
i want to move the onclick to an a href tag inside the div. i can't figure out how to specify "which" div. before i could simply use "this".
the function:
function expand( div, height ) {
var style = div.style;
if( divIsOpen ){
style.height = "16px";
divIsOpen = false;
}
else{
style.height = height+"px";
divIsOpen = true;
}}
ps. javascript newbie alert.
- SteveJobs0
give your div an id such like id='myNoobDiv', then in your function set it with myNoobDiv.style.property
- foreign0
cheers. i'll see if i can get it to work.
anyone have links to resources or examples of something similar?