Results 1 to 9 of 9

Thread: IE shows object error

  1. #1
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default IE shows object error

    I was testing beta site for cross browser errors or stuff and this is what IE tells me

    Code:
    Webpage error details
    
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; Tablet PC 2.0; InfoPath.3)
    Timestamp: Tue, 8 May 2012 14:50:00 UTC
    
    
    Message: Object required
    Line: 1506
    Char: 1
    Code: 0
    URI: http://bloghutsbeta.blogspot.com/2012/04/testing-main.html
    Can someone tell what is wrong? and sometimes it give alpha filter something error too, what is that?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    In this on page script:

    Code:
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    The highlighted line is where the error is coming from. All browsers see it as an error. IE 8 is more aggressive about reporting such things. The problem is that there is no element with an id of posttitle.

    This appears to be a setup script - one that sets some variables later used by another script. Perhaps that other script is no longer associated with the page, or it can get by without the related post variable being set.

    You could change the code to:

    Code:
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle")? document.getElementById("posttitle").innerHTML : '';
    </script>
    Then if there is another script that uses it, that script should still be happy and there will be no error.

    But if there is no other script that uses that stuff, you can remove the entire block of code.

    There is another script associated with the page that uses those variables:

    http://bloghuts.googlecode.com/files/related-postsupdated.js

    I'm not sure if that script is being used or not. If it is, it might throw an error when it gets to using the relatedposttitle, that is unless you make the change as noted above. But it might not, because it tests its length before using it. That may or may not be enough to avoid an error if it's undefined.

    My suggestion would be simply to make the change, it won't hurt anything, and it will get rid of the error.



    The filter error sounds like something Firefox would give. Are you sure it's IE 8? If it's Firefox, it's not really an error, just a warning telling you that Firefox doesn't support the filter style property.

    If it is IE 8 though, I would have to see the error to diagnose it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    cryoffalcon (05-08-2012)

  4. #3
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    thanks alot for quick reply and an awesome reply like always, yes I saw that it was something that I was thinking on fixing on later date. It is actually an error as I tried to make something out of it but I failed. And I tried to find that filter error but I was not able to find, I thought maybe IE is talking about the filter property that I have used in opacity but I don't see that anymore so I can't show it ^_^

    Well about that javascript error, it is something that I am trying but I am not able to do so, you are right it is associated to that external javascript file.
    What I am trying to do is that I want that Var to show a Different text on different page of that site e-g on one page it shows 'Related Results' on other page it shows 'Game Results' or maybe 'Story Results' but when I tried to do that it failed me and give an error, it gives and error because this is what I tried to do

    Code:
    <div id="posttitle" style="display: none;">Related Results</div>
    and this is the var I added
    Code:
    var relatedpoststitle = document.getElementById(&quot;posttitle&quot;).innerHTML;
    In this way I was going to add that DIV to all pages and then I was going to change that Related Results written in DIV to something else so In this way on every different page it will show different TEXT but I failed as my JS runs before the DIV and I can't control this factor of loading. So as JS loads first not the DIV in this way it gives an error.

    Do you have any solution to it how to resolve this issue? I hope I have made my point clear :P

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    There are various ways of delaying your code until the div you are looking for arrives on the page. However, even after the page loads, it's still not there. When does it arrive?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #5
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Well you can see this page it has the DIV added to it http://bloghutsbeta.blogspot.com/201...ng-slider.html

  7. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    That page has it (the posttitle div) hard coded (either in the page's source or via server side include or other server side code), so the safest/easiest thing would be to move you scripts to the last thing before the closing </body> tag:

    Code:
     . . . anager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML3', 'sidebar2', null, document.getElementById('HTML3'), {}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', null, document.getElementById('Blog1'), {'cmtInteractionsEnabled': false}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'headerleft', null, document.getElementById('HTML2'), {}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar'));
    </script>
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    <script src='http://bloghuts.googlecode.com/files/related-postsupdated.js' type='text/javascript'></script>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. The Following User Says Thank You to jscheuer1 For This Useful Post:

    cryoffalcon (05-09-2012)

  9. #7
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    That page has it (the posttitle div) hard coded (either in the page's source or via server side include or other server side code), so the safest/easiest thing would be to move you scripts to the last thing before the closing </body> tag:

    Code:
     . . . anager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML3', 'sidebar2', null, document.getElementById('HTML3'), {}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', null, document.getElementById('Blog1'), {'cmtInteractionsEnabled': false}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'headerleft', null, document.getElementById('HTML2'), {}, 'displayModeFull'));
    _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar'));
    </script>
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    <script src='http://bloghuts.googlecode.com/files/related-postsupdated.js' type='text/javascript'></script>
    </body>
    </html>
    Well thanks for replying again ^^ I have read it many times that one should place scripts at the end but sometimes they stop working. Same is the case with this script, I moved it to the end as you mentioned you can see it, it is in the place you recommend but now it stopped working :P

  10. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,920
    Thanks
    43
    Thanked 3,187 Times in 3,151 Posts
    Blog Entries
    12

    Default

    I see. That's because other scripts also depend upon these two scripts. Try putting them here right after the posttitle div:

    Code:
    </ul><br />
    <br />
    <br />
    <br />
    <div id="posttitle" style="display: none;">Related Results</div>
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    <script src='http://bloghuts.googlecode.com/files/related-postsupdated.js' type='text/javascript'></script>
    <div style='clear: both;'></div>
    </p>
    <div class='post-footer'>
    </div>
    </div>
    <div id='related-posts'>
    <script src='/feeds/posts/default/-/testing?alt=json-in-script&callback=related_results_labels_thumbs&max-results=15' type='text/javascript'></script>
    <script type='text/javascript'>
    removeRelatedDuplicates_thumbs();
    printRelatedLabels_thumbs("http://bloghutsbeta.blogspot.com/2012/04/testing-slider.html");
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  11. The Following User Says Thank You to jscheuer1 For This Useful Post:

    cryoffalcon (05-09-2012)

  12. #9
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    I see. That's because other scripts also depend upon these two scripts. Try putting them here right after the posttitle div:

    Code:
    </ul><br />
    <br />
    <br />
    <br />
    <div id="posttitle" style="display: none;">Related Results</div>
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    <script src='http://bloghuts.googlecode.com/files/related-postsupdated.js' type='text/javascript'></script>
    <div style='clear: both;'></div>
    </p>
    <div class='post-footer'>
    </div>
    </div>
    <div id='related-posts'>
    <script src='/feeds/posts/default/-/testing?alt=json-in-script&callback=related_results_labels_thumbs&max-results=15' type='text/javascript'></script>
    <script type='text/javascript'>
    removeRelatedDuplicates_thumbs();
    printRelatedLabels_thumbs("http://bloghutsbeta.blogspot.com/2012/04/testing-slider.html");
    Well I tried this method earlier too and when you told me to do this I thought okay I will do it again but I already tried it I know it is not going to work BUT IT WORKED ^^ and then I realized what I was doing is that I was just copying this part of code and putting in the place where you told me to put

    Code:
    <script type='text/javascript'>
    var defaultnoimage="http://1.bp.blogspot.com/_u4gySN2ZgqE/SosvnavWq0I/AAAAAAAAArk/yL95WlyTqr0/s400/noimage.png";
    var maxresults=14;
    var splittercolor="none";
    var relatedpoststitle = document.getElementById("posttitle").innerHTML;
    </script>
    while you told me to add the other script too, So now Issue resolved THANK YOU ONCE AGAIN, YOU ROCK ^_^

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •