RIRedinPA Posted May 27, 2010 Share Posted May 27, 2010 I'm putzing around trying to make myself smarter (it's a big hill to climb) and writing some js code to see what happens... I wrote this and got the WrappedNative prototype object execption error so I'm trying to debug but I'm not sure what this error message is telling me...the Google is no help, lot's of examples of other folks about as smart as me but couldn't find an explanation of the generic error... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Javascript Stuff</title> <!--CSS Link--> <script language="javascript"> var parentObject = { one: function () { document.write("This is function 1"); }, two: function() { document.write("This is function 2"); } }; function init() { document.write(parentObject.one() + parentObject.two()); } window.onload = init; </script> </head> <body> </body> </html> The whole error message: Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: http://macdev2.merion.com/area51/javascript/ :: init :: line 22" data: no] I should note it does what I wanted it to, the output from the code is: This is function 1This is function 2 Quote Link to comment https://forums.phpfreaks.com/topic/203085-what-is-a-wrappednative-prototype-object-execption/ Share on other sites More sharing options...
ignace Posted May 27, 2010 Share Posted May 27, 2010 document.write(parentObject.one() + parentObject.two()); Should be either parentObject.one(); parentObject.two(); or replace document.write() to return() in these functions. Quote Link to comment https://forums.phpfreaks.com/topic/203085-what-is-a-wrappednative-prototype-object-execption/#findComment-1064124 Share on other sites More sharing options...
RIRedinPA Posted May 27, 2010 Author Share Posted May 27, 2010 Thanks! And that actually made sense to me. Quote Link to comment https://forums.phpfreaks.com/topic/203085-what-is-a-wrappednative-prototype-object-execption/#findComment-1064139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.