MozTW 討論區
https://forum.moztw.org/

在FF中讀取javascript程式,為何會事件的錯誤呢?
https://forum.moztw.org/viewtopic.php?f=2&t=16160
1 頁 (共 1 頁)

發表人:  medo [ 2006-11-01, 14:09 ]
文章主題 :  在FF中讀取javascript程式,為何會事件的錯誤呢?

各位大大
我是剛接觸FF的新手,想請問為什麼我在FF中,javascript的功能完全不能執行。請各位大大幫幫我吧!
程式如下:
代碼:
<script type="text/javascript">
function CheckValue()
{
   objResult = new Array()
   strValue = document.Form1.Search.value;
   strScript = "";
   if(strValue.length > 0)
   {
   j = 0;
   if(document.all)
   {
      menu.innerHTML=strScript ;
   }
   if(document.layers)
   {
      document.Form1.menu.document.write(strScript);
      document.Form1.menu.document.close();
   }
   for(i = 0 ;i < objList.length ; i ++)
   {
   
      if(objList[i].search(strValue) == 0)
      {
         
         objResult[j] = objList[i];
         j ++
      }
   }
   if(objResult.length > 0)
   {
      strScript = "<span style='border:1px; solid #000000; position:absolute; overflow:hidden; left:10%;' ><select name='FORUMS_TO_SEARCH' size="+objResult.length+" style='background-color:#ffffff;border=0;width:300px;margin:-2px;' onchange='Form1.Search.value=this.value;' onclick='SetValue();' onKeydown='HiddenMenu();'>"
      for(i = 0 ; i < objResult.length ; i ++)
      {
         strScript += "<option value='" + objResult[i] + "'>"+objResult[i]+"</option>";
         
      }
      strScript += "</select></span>";
      if(document.all)
      {
         menu.innerHTML=strScript ;
      }
      if(document.layers)
      {
         document.Form1.menu.document.write(strScript);
         document.Form1.menu.document.close();
      }
      menu.style.visibility = "visible";
   }
}

   
    
}
function HiddenMenu()
{
   //Enter
   if(event.keyCode == 13)
   {
      menu.style.visibility = "hidden";
      document.Form1.Search.focus();
   }
   
}
function SetValue()
{
   document.Form1.Search.value = document.Form1.FORUMS_TO_SEARCH.value;
   menu.style.visibility = "hidden";
   document.Form1.Search.focus();
}
function SetFocue()
{
   //Down
   if(event.keyCode==40)
   {
      if(document.Form1.FORUMS_TO_SEARCH != null)
      {
         document.Form1.FORUMS_TO_SEARCH.selectedIndex = 0;
         document.Form1.FORUMS_TO_SEARCH.focus();
      }
   }
}


function a_send_db_tables()   
 {   
     search = document.Form1.Search.value;   
     url = "readpagetry.asp?search="+search
     window.location=url
     
 
 } 
</script>


錯誤訊息為
event is not defined 以及 menu is not defined
請問這該如何修改呢?? :shock:

發表人:  BobChao [ 2006-11-01, 15:39 ]
文章主題 : 

引言回覆:
錯誤訊息為
event is not defined 以及 menu is not defined
請問這該如何修改呢?? :shock:


參考一下: 事件差異

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/