Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Strange Parser Error

  • 03-09-2003 10:57am
    #1
    Closed Accounts Posts: 156 ✭✭


    I have a page with the following javascript

    if(ie4)
    {
    var myStr1 = "<OBJECT .......";
    var mystr2="</object>";
    document.write(myStr1);
    }
    else
    {
    document.write("<OBJECT .......");
    }


    The browser throws an error if i dont have var mystr2="</object>"; Complainging i cant have one object tag inside another, mystr2 is never used it is just there to get the parser to continue.

    Strange thing is this happens in both IE6 and NS7 - could it be both NS and MS are getting their parsers from someone else. The parser seems to ignore the fact the object tag is inside a javascript block. - I thought it wierd that both browsers would have this bug/feature.


Comments

  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    How did you open your javascript declaration?
    If you provide the full code block it would be easier to see what you are doing


  • Closed Accounts Posts: 156 ✭✭JJSolutions


    Nothing much exciting happening outside the above code


    <script language="JavaScript">
    <!--
    function f()
    {
    ... browser check code ....

    if(ie4)
    {
    var myStr1 = "<OBJECT .....";
    var mystr2="</object>";
    document.write(myStr1);
    }
    else
    {
    document.write("<OBJECT .....");
    }
    }
    //-->
    </script>


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Try setting the mime type and see what happens


  • Closed Accounts Posts: 156 ✭✭JJSolutions


    nope didnt make a difference - i even noticed that if the line

    var mystr2="</object>";

    is commented out it still makes it work but once it is deleted the error occurs

    even

    //</object>

    works - as long as there is a closing object tag it will work.

    Why do you think that the behavior is the same on NS and MS


  • Registered Users, Registered Users 2 Posts: 1,452 ✭✭✭tomED


    It's hard to get an idea of what you are trying to do without an example of the exact code you are using.

    Why not give use exactly what you are doing and we'll try and see whats wrong.

    I have tried to replicate what I think you are saying with my own code and have had no problems.

    But maybe I'm doing something different...


  • Advertisement
  • Closed Accounts Posts: 156 ✭✭JJSolutions


    That is the whole code - I havent got a problem with the code, it is on the jjsolutions.ie homepage if you want to look at it.

    The point i was trying to make was it is strange that both browsers dont pick up that the two object tags are being written dynamically to the page and thinks there is two open object tags inside each other.

    .. and that even commented code will prevent the error from occurring


Advertisement