-1

这是我的javascript函数..

 <script>
    var count=0;

    function mafunct(flash){

    var path="a"+count+".swf";  

    var flash ='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" WIDTH="100%" HEIGHT="100%">';          
        flash+='<PARAM NAME="movie" VALUE='+path+' >';          
        flash+='<PARAM NAME="PLAY" VALUE="false">';  
        flash+='<PARAM NAME="LOOP" VALUE="false">';
        flash+='<PARAM NAME="QUALITY" VALUE="high">';
        flash+='<PARAM NAME="SCALE" VALUE="SHOWALL">';
        flash+='<EMBED NAME="testmovie" SRC="Menu.swf" WIDTH="100%" HEIGHT="100%"PLAY="false" LOOP="false" QUALITY="high" SCALE="SHOWALL"swLiveConnect="true"PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">';
        flash+='</EMBED>';
        flash+='</OBJECT>';  
This is a **button** inside the javascript function that show the bottom and out side of flash when click the first button

        flash+='<button onclick=mafunct()>next</button>';
        document.write(flash);
        alert(flash);
    count++;

    }
    </script>

这是我在 html 中的按钮代码

<button onclick=mafunct()>next</button>

当我单击此按钮时,第一个 flash 将起作用,并且 javascript 函数中的按钮将显示,但该按钮在那里不起作用...

4

1 回答 1

4

尽量避免使用 document.write。试试这个代码来创建按钮。

<style type = "text/css">
    .myButton
    {
        position:absolute;
        top:600px;
        left:300px;
        z-index:3000;
    }
</style>
var myButton = document.createElement("input");
myButton.type = 'button';
myButton.value = 'click Me';
myButton.className = 'myButton';
myButton.name = 'myButton';
myButton.onclick = function() { 
    mafunct();
};
document.body.appendChild(myButton);
于 2013-06-14T05:10:32.830 回答