该例子主要说明两点:
   
1.Use this method,You can new a menu that can not hidden by ocx and select objcets

    2.the usage of public method of Object

Test_main.htm


<script language="jscript">
 
function btnTestClick()
 {
  
var obj = document.getElementById('objTest');
  
if (obj != null)
  {
   obj.style.display
='';
   obj.style.left
=event.clientX;
   obj.style.top
=event.clientY;
   
   
//Call object's public function
   obj.SetDefaults("00000");
  }  
 }
</script>
<body > 
    
<input type="button" id="btnTest" value="Click Me" onclick="btnTestClick()"  
         style
="position:absolute;width:100;height:100;top:110;left:110;"/>
     
    
<OBJECT id="objTest"  type="text/x-scriptlet" data="Test_chlid.asp" 
        style
="position:absolute;width:100;height:100;top:0;left:0;">
    
</OBJECT> 
</body>


Test_Chidd.asp

<div id="divtest" ></div>
<script language="jscript">
function public_SetDefaults(strFlag)
{
    
//alert (1)
    if(strFlag ="Y")
    {
        document.all.divtest.innerHTML
="Line1<br><Line2>"
    }
    
else
    {
        document.all.divtest.innerHTML
="Line3<br><Line4>"
    }
}
</script>
posted on 2005-02-01 20:06  袁礼定  阅读(327)  评论(0编辑  收藏  举报