JavaScript-bookmarklets.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script>
  2. var arr = new Array("var%20x=' ';", // Space %20
  3. "var%20x='#';", // # %23
  4. "var%20x='$';", // $ %24
  5. "var%20x='%';", // % %25
  6. "var%20x='&';", // & %26
  7. "var%20x='/';", // / %2F
  8. "var%20x=':';", // : %3A
  9. "var%20x=';';", // ; %3B
  10. "var%20x='<';", // < %3C
  11. "var%20x='=';", // = %3D
  12. "var%20x='>';", // > %3E
  13. "var%20x='?';", // ? %3F
  14. "var%20x='@';", // @ %40
  15. "var%20x='[';", // [ %5B
  16. "var%20x='\\';", // \ %5C
  17. "var%20x=']';", // ] %5D
  18. "var%20x='^';", // ^ %5E
  19. "var%20x='`';", // ' %60
  20. "var%20x='{';", // { %7B
  21. "var%20x='|';", // | %7C
  22. "var%20x='}';", // } %7D
  23. "var%20x='~';"); // ~ %7E
  24. function makeLinks()
  25. {
  26. var str = "javascript:";
  27. var anchor, anchorText;
  28. for (key in arr)
  29. {
  30. anchor = document.createElement("a");
  31. anchor.setAttribute("href", str+arr[key]);
  32. anchorText = document.createTextNode(arr[key]);
  33. anchor.appendChild(anchorText);
  34. document.body.appendChild(anchor);
  35. document.body.appendChild(document.createElement("br"));
  36. }
  37. }
  38. </script>
  39. <body onload="makeLinks();">
  40. This test is for <a href="rdar://problem/5310312">rdar://problem/5310312</a> and can be run manually only.<br>
  41. <a href="rdar://problem/5379908">rdar://problem/5379908</a> tracks the effort to enhance DRT to make this into a layout test.<br>
  42. <br>
  43. <b>Directions:</b>
  44. <ol>
  45. <li> drag each link below to the bookmarks bar to create bookmarks
  46. <li> open the JavaScript console (in the debug menu)
  47. <li> click on all the bookmarks you've just created
  48. </ol>
  49. <b>Expected results:</b>
  50. no parse errors in the JavaScript console<br>
  51. <br>
  52. </body>