<script type="text/javascript">
function SelectTag(var id){
alert(document.getElementById(id).innerText);
document.getElementById(id).Style="border:#cccccc solid 1px";
}
</script>
 <p id="pds"> 惊喜一夏!</p>
<button onclick="return SelectTag('pds')">点击右惊喜</button>上面是我写的一段代码
请各位大神看看有什么问题
我点击按钮总是出现缺少对象的错误

解决方案 »

  1.   

      <script type="text/javascript"> 
    function SelectTag(id)

    alert(document.getElementById(id).innerText); 
    document.getElementById(id).style.border="1px solid red"; 

    </script> 
    <p id="pds"> 惊喜一夏! </p> 
    <button onclick="SelectTag('pds')">点击右惊喜</button> 
      

  2.   

    <script type="text/javascript"> 
    function SelectTag(var id){ 
    alert(document.getElementById(id).innerText); 
    document.getElementById(id).Style="border:#cccccc solid 1px"; 

    </script> 
    <p id="pds"> 惊喜一夏! </p> 
    <button onclick="return SelectTag('pds')">点击右惊喜 </button> Web 开发常用手册JScript语言参考.rar
    http://download.csdn.net/source/308916DHTML参考手册.rar
    http://download.csdn.net/source/308913样式表中文手册.chm
    http://download.csdn.net/source/304124
      

  3.   


    <script type="text/javascript"> 
    function SelectTag(id){ 
    alert(document.getElementById(id).innerText); 
    document.getElementById(id).style.cssText="border:#cccccc solid 1px"; 

    </script> 
    <p id="pds"> 惊喜一夏! </p> 
    <button onclick="return SelectTag('pds')">点击右惊喜 </button>