Calling external JS or JQuery


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var jqscript=document.createElement('script');jqscript.setAttribute("type","text/javascript");jqscript.setAttribute("src","http://code.jquery.com/jquery-latest.js");document.getElementsByTagName("head")[0].appendChild(jqscript);
  2.  
  3.  
  4.  
  5.  
  6. /******************************************************************************/
  7.  
  8.  
  9.  
  10. integer face = 4;
  11. string externalJavascript =
  12. "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js";
  13. default
  14. {
  15. state_entry()
  16. {
  17. string dataURI = "data:text/html," +
  18. "<head><script src='" + externalJavascript + "'></script></head>" +
  19. "<button>Toggle</button>" +
  20. "<p>Hello<br />World</p>" +
  21. "<script>$('button').click(function () " +
  22. "{$('p').slideToggle('slow');});</script>";
  23. llSetPrimMediaParams(face,
  24. [PRIM_MEDIA_CURRENT_URL, dataURI]);
  25. }
  26. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.