By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,168 Members | 696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,168 IT Pros & Developers. It's quick & easy.

style.display='block' is not working

P: 5
I have a hidden span within a table column and I cannot unhide it using style.display='block' ??

Sample code
<table>
<tr>
<td><input name="status" value=""></td><td><input type="button" value="search" onClick="searchByStatus()"></td>
<td><div id="MySpan" Style="display:none"><img src="ajaxprogressindicator.gif"></div></td>
</tr>
</table>

var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
function searchByStatus(){
var f=document.forms[0];
var key =f.status.value;
if(key==''){
alert("Please select a status");
return;
}
MySpan.style.display='block';
var url = "/"+document.forms[0].getdbpath.value+"/StatusSearch?OpenAgent";
pdata="&a="+key;
xmlHttp.open("POST",url,false);
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length",pdata.length);
xmlHttp.setRequestHeader("Connection","close");
xmlHttp.onreadystatechange = processSearchXML
xmlHttp.send(pdata)
}
I have used a similar method in the past. the location of the span, inside or outside of the table does not seem to matter.
I have got the image to appear by placing an alert after the line:
MySpan.style.display='block';.
Maybe this has something to do with a small result set, but in the past with only one result I still saw the image flicker and in this case I am returning over 25 results from the server.
May 25 '07 #1
Share this Question
Share on Google+
3 Replies

P: 74
I have a hidden span within a table column and I cannot unhide it using style.display='block' ??
...
I have got the image to appear by placing an alert after the line:
MySpan.style.display='block';.
Maybe this has something to do with a small result set, but in the past with only one result I still saw the image flicker and in this case I am returning over 25 results from the server.

Have you tried :
Expand|Select|Wrap|Line Numbers
  1. document.getElementByID('MySpan').style.visibility = 'visible';
  2.  
or
Expand|Select|Wrap|Line Numbers
  1. document.getElementByID('MySpan').style.display = 'block';
  2.  
I think you need to use the getElementByID() method and set the style that way.

-LilOlMe
May 25 '07 #2

P: 5
Yes, I tried document.getElementById('MySpan').style.display='b lock' as well as document.all['MySpan'].style.display='block';.
The way I call the span does not seem to have an effect.
May 25 '07 #3

acoder
Expert Mod 15k+
P: 16,027
If the result comes back very fast, is there a problem?

I think that you should use visibility instead so that the page layout doesn't change, but that depends on how the page is.
May 26 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.