Hi guys,
My JS is terrible so forgive me, but I'm having trouble with a function to hide/show divs, the code is as follows:
however when I call edit() (button onclick) it only performs the first show/hide action after resolving the if (for example state==1, would result in "state=0;
document.getEle mentById('edito r_area').style. display='none'; " being actioned);
how can I fix this?
I hope this makes sense.
thanks in advance
My JS is terrible so forgive me, but I'm having trouble with a function to hide/show divs, the code is as follows:
Code:
var state
state=0;
function edit(){
if(state==0){
state=1;
document.getElementById('editor_area').style.display='inline';
document.getElementById('display_area').style.display='none';
document.getElementById('jump').focus()
};
else{
state=0;
document.getElementById('editor_area').style.display='none';
document.getElementById('display_area').style.display='inline';
};
};
document.getEle mentById('edito r_area').style. display='none'; " being actioned);
how can I fix this?
I hope this makes sense.
thanks in advance
Comment