日期:2014-05-18  浏览次数:20357 次

指定doctype后,js脚本不起作用,该怎样修改
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head runat="server">
  <title></title>
  <script type="text/javascript"><!--
  function cellkeydown(event) {
  if (event.ctrlKey && event.keyCode == 86) {
  var ss = document.getElementById("TextArea1");
  ss.focus();
  ss.select();
  // 等50毫秒,keyPress事件发生了再去处理数据 
  setTimeout("dealwithData()", 50);
  }
  }
  function dealwithData(event) {
  var ss = document.getElementById("TextArea1");
  alert(ss.value);
  //document.getElementById("<%=Button2.ClientID %>").click();
  ss.blur();
  } 
// --></script> 
</head>
<body onkeydown="return cellkeydown(event)">


------解决方案--------------------
LZ后缀改了么
------解决方案--------------------
VB.NET code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Testerror.aspx.vb" Inherits="Testerror" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test</title>
    <script type="text/javascript">
        function cellkeydown(event)
        {
        
          if (event.ctrlKey && event.keyCode == 86) {
          var ss = document.getElementById("TextArea1");
          ss.focus();
          ss.select();
          // 等50毫秒,keyPress事件发生了再去处理数据  
          setTimeout("dealwithData()", 50);
          }
  }
  function dealwithData(event) {
  var ss = document.getElementById("TextArea1");
  alert(ss.value);

  ss.blur();
        }
    
    
    </script>
</head>
<body  onkeydown="return cellkeydown(event)">
   <textarea id="TextArea1" name="TextArea1"></textarea>
</body>
</html>