tags:

views:

60

answers:

2

I am developing a News application and for this i am using a web product for fetching News Headline. When I call a NewsHeadline, product sends a Html Code including News Headline.

<div class="mydiv">


<script type="text/javascript">
  document.write('&lt;div style="display: none"&gt;');
</script><div style="display: none;">

<div>< a href="http:// www.abc.com.au/ news_manager/default.aspx ?z=41">Main News Item 6</a>

</div>
<script type="text/javascript">
  document.write('&lt;/div&gt;');
</script></div>

<script src="http://www.abc.com/news_manager/ajaxzone.aspx?z=41&amp;amp;pz=125&amp;amp;h=1&amp;amp;sort=startdate&amp;amp;ord=desc&amp;amp;xlaparsing=true" language="javascript"></script><div id="xlaANMzone_928960"><div class="" id="928960"><h5>
  <a href="http://www.mysite.com/article.asp?a=1144&amp;amp;Z=41"&gt;
     test article from anil
  </a>
</h5>
</div>
[red]<div align="left"></div>[/red]
</div>

</div>

The Newsproduct is sending an extra div ie (<div align="left"></div>) on the lower end of above code. and this div is taking extra space in IE 6, and 7 only. its working fine in OPera,FF and Safari.

So what I need is to DELETE this extra div either on document ready or on load event. I used some scripts not worked for me. Any help would be appreciated.

A: 

i am not sure but you can check by

 var check = $("div").css('display');
        if (check == "none") {
           /// Doing action here
        }
4thpage
Thanks for Reply.....Infact I am newbie in JQuery. So better if you describe some more points...
Anil
+1  A: 

Well, just like 4thpage already showed, I would use jQuery for this job as well.

$(document).ready(function() {
  $('div[align=left]').remove();
});

This code will fire on the document.ready event and then search for any div-tag with the attribute align=left and will remove that element from the DOM.

nyn3x
Was working on the same. :-)
San
wait... I am testing it
Anil
I put like this in the <Head> tag.<script language="javascript">$(document).ready(function() { $('div[align=left]').remove();}); </script>But it didnot work on IE
Anil
did you add a reference to the jQuery library as well? Look at http://docs.jquery.com/Downloading_jQuery for downloading jQuery.Just add the reference to like`<script src=jQuery-1.4.2.js language=javascript></script>`You probably want to do this before your other script-tage.
nyn3x
@@nyx3xThanxx for Reply..Yes I included Jquery library.. but No Solution Yet
Anil
what browser did you try that on? Could you post your current code here?
nyn3x
Tested on IE 7. Only this is creating problem of extra Div space.<head><script src="jquery/jquery-1.4.2.min.js" language="javascript"></script><script language= "javascript">$(document).ready(function() { $('div[align=left]').remove();});</script></head><body>/// dynamically created divions here</body>
Anil