Reputation: 1082
So in chrome I can open and close the pop-up div using this javascript code:
<script language="javascript">
function expand_day(daynr) {
var controlnaam = 'cal_' + daynr;
var control = document.getElementById(controlnaam)
if (control) {
var pd = document.getElementById('popupDiv');
if (pd){
var output = '<table border="0" cellpadding="10" style="width:100%;border:solid 0px #000000;background-color:white;color:black;">';
output += '<tr><td><span style="float:right;"><a href="Javascript:closePopup();return false;">close</a></span></td></tr>';
output += '<tr><td>';
//alert(control.innerHTML);
pd.innerHTML = output + control.innerHTML + '</td></tr></table>';
pd.style.display='block';
}
}
}
function closePopup() {
var pd = document.getElementById('popupDiv');
if (pd){
pd.style.display='none';
}
}
</script>
But when I do this in Internet Explorer 9 I can open the pop-up div, but can´t close it. How can I close this in Internet Explorer 9?
Upvotes: 2
Views: 246
Reputation: 193261
This line:
<a href="Javascript:closePopup();return false;">close</a>
should be changed to
<a href="Javascript:closePopup();">close</a>
So you can't use return
statement in this context. IE complains SCRIPT1018: 'return' statement outside of function
.
Аlternatively you could use onclick
instead of href
:
<a onclick="closePopup();return false;">close</a>
Upvotes: 1
Reputation: 606
Can you try like this
pd.style.display="hidden"
I think their are issues about .display="none"
Upvotes: 0