functions.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. 
  2. // nav menu
  3. var timeout = 500;
  4. var closetimer = 0;
  5. var ddmenuitem = 0;
  6. // open hidden layer
  7. function mopen(id)
  8. {
  9. // cancel close timer
  10. mcancelclosetime();
  11. // close old layer
  12. if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
  13. // get new layer and show it
  14. ddmenuitem = document.getElementById(id);
  15. ddmenuitem.style.visibility = 'visible';
  16. }
  17. // close showed layer
  18. function mclose()
  19. {
  20. if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
  21. }
  22. // go close timer
  23. function mclosetime()
  24. {
  25. closetimer = window.setTimeout(mclose, timeout);
  26. }
  27. // cancel close timer
  28. function mcancelclosetime()
  29. {
  30. if(closetimer)
  31. {
  32. window.clearTimeout(closetimer);
  33. closetimer = null;
  34. }
  35. }
  36. //产品分类导航
  37. var menuids=["suckertree1"] //Enter id(s) of SuckerTree UL menus, separated by commas
  38. function buildsubmenus(){
  39. for (var i=0; i<menuids.length; i++){
  40. var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
  41. for (var t=0; t<ultags.length; t++){
  42. ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
  43. ultags[t].parentNode.onmouseover=function(){
  44. this.getElementsByTagName("ul")[0].style.display="block"
  45. }
  46. ultags[t].parentNode.onmouseout=function(){
  47. this.getElementsByTagName("ul")[0].style.display="none"
  48. }
  49. }
  50. }
  51. }
  52. if (window.addEventListener)
  53. window.addEventListener("load", buildsubmenus, false)
  54. else if (window.attachEvent)
  55. window.attachEvent("onload", buildsubmenus)
  56. function comment_check() {
  57. if ( document.form1.name.value == '' ) {
  58. window.alert('请输入姓名^_^');
  59. document.form1.name.focus();
  60. return false;}
  61. if ( document.form1.email.value.length> 0 &&!document.form1.email.value.indexOf('@')==-1|document.form1.email.value.indexOf('.')==-1 ) {
  62. window.alert('请设置正确的Email地址,如:webmaster@hitux.com');
  63. document.form1.email.focus();
  64. return false;}
  65. if(document.form1.qq.value.search(/^([0-9]*)([.]?)([0-9]*)$/) == -1)
  66. {
  67. window.alert("QQ只能是数字^_^");
  68. document.form1.qq.focus();
  69. return false;}
  70. if ( document.form1.content.value == '' ) {
  71. window.alert('请输入内容^_^');
  72. document.form1.content.focus();
  73. return false;}
  74. if ( document.form1.verycode.value == '' ) {
  75. window.alert('请输入验证码^_^');
  76. document.form1.verycode.focus();
  77. return false;}
  78. return true;}
  79. function order_check() {
  80. if ( document.form1.ordercount.value == '' ) {
  81. window.alert('请输入订购数量^_^');
  82. document.form1.ordercount.focus();
  83. return false;}
  84. if(document.form1.ordercount.value.search(/^([0-9]*)([.]?)([0-9]*)$/) == -1)
  85. {
  86. window.alert("订购数量只能是数字^_^");
  87. document.form1.ordercount.focus();
  88. return false;}
  89. if ( document.form1.name.value == '' ) {
  90. window.alert('请输入联系人^_^');
  91. document.form1.name.focus();
  92. return false;}
  93. if ( document.form1.address.value == '' ) {
  94. window.alert('请输入联系地址^_^');
  95. document.form1.address.focus();
  96. return false;}
  97. if ( document.form1.tel.value == '' ) {
  98. window.alert('请输入联系电话^_^');
  99. document.form1.tel.focus();
  100. return false;}
  101. if ( document.form1.email.value.length> 0 &&!document.form1.email.value.indexOf('@')==-1|document.form1.email.value.indexOf('.')==-1 ) {
  102. window.alert('请设置正确的Email地址,如:webmaster@hitux.com');
  103. document.form1.email.focus();
  104. return false;}
  105. if(document.form1.qq.value.search(/^([0-9]*)([.]?)([0-9]*)$/) == -1)
  106. {
  107. window.alert("QQ只能是数字^_^");
  108. document.form1.qq.focus();
  109. return false;}
  110. if ( document.form1.verycode.value == '' ) {
  111. window.alert('请输入验证码^_^');
  112. document.form1.verycode.focus();
  113. return false;}
  114. return true;}