How to handle innerHTML using javascript
I need to create a table within the page when the submit button is clicked.. so i use onclick() to call the function javascript.. its working fine for one submit button.. if i had more than one submit b开发者_Go百科utton its not working fine..
here is the coding javascript coding.
function openemailbox(formtitle, fadin)
{
var box1 = document.getElementById('box');
document.getElementById('filter1').style.display='block';
var btitle1 = document.getElementById('boxtitle');
btitle1.innerHTML = formtitle;
if(fadin) {
gradient1("box1", 0);
fadein1("box1");
}
else {
box1.style.display='block';
}
}
the jsp coding is
<div id="filter1"></div>
<div id="box1">
<span id="boxtitle"></span>
...
</div>
if i give two javascript it is working fine for 1 and not for another..instead it displaying without going into the onclick()
I don't see a 'boxtitle1' element in your HTML. Is it possible that when you try to set btitle1.innerHTML you're throwing an exception and the rest of your code is getting skipped?
Have you tried walking through the code in firebug or WebKit developer tools to see what happens?
精彩评论