Use js and C \

From , 5 Years ago, written in C#, viewed 106 times.
URL https://pastebin.vip/view/f74412c3
  1. <HTML>
  2. <HEAD>
  3. <TITLE>下拉框模拟只读</TITLE>
  4. <script type="text/javascript">
  5. //根据下拉框ID设置下拉框只读
  6. function setReadOnly(obj_id){
  7. var obj = document.getElementById(obj_id);
  8. obj.onmouseover = function(){
  9. obj.setCapture();
  10. }
  11. obj.onmouseout = function(){
  12. obj.releaseCapture();
  13. }
  14. obj.onfocus = function(){
  15. obj.blur();
  16. }
  17. obj.onbeforeactivate = function(){
  18. return false;
  19. }
  20. }
  21. </script>
  22. </HEAD>
  23. <BODY>
  24. <span id="span_select">
  25. <select id="id_select">
  26. <option value="1">AAAAAAAAA</option>
  27. <option value="2">BBBBBBBBB</option>
  28. <option value="3">CCCCCCCCC</option>
  29. <option value="4">DDDDDDDDD</option>
  30. </select>
  31. </span>
  32. <script type="text/javascript">
  33. setReadOnly("span_select");
  34. </script>
  35. <!-- 直接设置下拉框只读 -->
  36. <select onbeforeactivate="return false" onfocus="this.blur()" onmouseover="this.setCapture()" onmouseout="this.releaseCapture()">
  37. </BODY>
  38. </HTML>
  39.  
  40.  
  41. //csharp/6006

Reply to "Use js and C \"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website