标题:新手,写代码遇到个小问题,请高手指教~~~~~
只看楼主
zgmmz
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-12-17
 问题点数:0 回复次数:2 
新手,写代码遇到个小问题,请高手指教~~~~~
function my_s(){

}

if (document.getElementById('my_checkbox') == null){
        var ck=document.createElement("input");
        ck.id = 'my_checkbox'
        ck.type="checkbox";
        document.getElementById('main').appendChild(ck);
}
if (document.getElementById('my_start') == null){
        var st=document.createElement("input");
        st.id = 'my_start'
        st.type="button";
        st.value="開始";
        st.onclick= function()
                {
                        var my_sel = document.getElementById('my_boss') ;
                        var my_index = my_sel.selectedIndex;//選中索引
                        var my_text = my_sel.options[my_index].text;//選中文本
                        var my_value = my_sel.options[my_index].value;//選中值
                        if (st.value == "開始"){
                                st.value = "停止";
                        }
                        else{
                                st.value = "開始";
                        }
                        var i = 0
                        for (; i<1;){
                                if (st.value == "停止"){
                                        if (document.getElementById("my_checkbox").checked ){ //表示正在攻擊怪物
                                                if (document.getElementById("div_fight_show_boss_fight").innerText =="战斗胜利"){ //讀取div信息
                                                        document.getElementById("my_checkbox").checked = false;
                                                        return_map_check();        //返回地圖
                                                }
                                                else{
                                                        setInterval("my_s();", 1000);
                                                }
                                        }
                                        else{
                                                document.getElementById("my_checkbox").checked = true;
                                                jinru_boss_fight_check();        //進入幻境
                                                setInterval("my_s();", 500);
                                                eval('my_value');        //根據選擇的BOSS進行攻擊
                                                setInterval("my_s();", 500);
                                        }
                                }
                                else{
                                        break; //退出循环
                                }                                       
                        }
                }

        document.getElementById('main').appendChild(st);
}
if (document.getElementById('my_boss') == null){
        var sl=document.createElement("select");
        sl.id = 'my_boss'
        document.getElementById('main').appendChild(sl);
        var varItem = new Option('半獸戰士', 'create_boss_fight_check(105,1)');      
               my_boss.options.add(varItem );
        var varItem = new Option('半獸勇士', 'create_boss_fight_check(106,1)');      
               my_boss.options.add(varItem );
        var varItem = new Option('屍王', 'create_boss_fight_check(133,1)');      
               my_boss.options.add(varItem );
}

上面是我写的脚本,想实现根据选择的BOSS,进入地图后,能自动循环攻击BOSS。流程:进入幻境,攻击选择的BOSS,返回地图,再进入幻境....
游戏网站:mir.
目前能够自动进入幻境,但是不攻击,应该不是在一个页面,无法执行my_value的值(进入幻境页面后执行my_value的值是进行攻击的)。请高手指教不在一个页面的怎么调用,好像不是框架的网站。谢谢!!!
搜索更多相关主题的帖子: function button null 
2014-10-16 12:06
zgmmz
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-12-17
得分:0 
沒有人幫忙嗎??????????????
2014-10-17 15:06
zgmmz
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-12-17
得分:0 
挂了4天了,估计再挂下去也是白挂了。
结了。
2014-10-20 08:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-437315-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.101385 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved