Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Using XUL and JSON, JSON.Parse function do not work
  2. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  3. <window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">
  4.  
  5. <button value="click" oncommand="jsonTest()" />
  6. <script type="text/javascript">
  7. <![CDATA[
  8. // put some js code here
  9.  
  10. function jsonTest(){
  11.  
  12. var funcionarios =
  13.     {
  14.         "Marconildo":
  15.         {
  16.             "url": "http://www.google.com.br/",
  17.             "idade": 34
  18.         }
  19. };
  20.  
  21. var funcionario = JSON.parse(funcionarios);
  22.  
  23. alert(funcionario.Marconildo);
  24.  
  25.  
  26. }
  27.  
  28. ]]>
  29. </script>
  30. </window>