标题:javascript if 问题
只看楼主
cai410579517
Rank: 3Rank: 3
来 自:宁德
等 级:论坛游侠
威 望:6
帖 子:128
专家分:179
注 册:2013-8-18
结帖率:88%
 问题点数:0 回复次数:2 
javascript if 问题
function editusets() {
    var bb = 1;
    var grey_dbbtn_date = document.getElementById("grey_dbbtn_date");
    grey_dbbtn_dates = $('#grey_dbbtn_date').text();
    if (bb == 1) {
        var usernames_admin = document.getElementById("usernames_admin");
        usernames_admins = $('#usernames_admin').text();
        var project_staff = document.getElementById("project_staff");
        project_staffs = $('#project_staff').text();
        var company_name = document.getElementById("company_name");
        company_names = $('#company_name').text();
        var company_web = document.getElementById("company_web");
        company_webs = $('#company_web').text();
        var company_address = document.getElementById("company_address");
        company_addresss = $('#company_address').text();
        usernames_admin.innerHTML = "<input type='text' id='usernames_mod' value='"
                + usernames_admins + "'//>"
        project_staff.innerHTML = "<input type='text'   id='project_mod' value='"
                + project_staffs + "'/>"
        company_name.innerHTML = "<input type='text'    id='company_mod' value='"
                + company_names + "'/>"
        company_web.innerHTML = "<input type='text'     id='company_web_mod'value='"
                + company_webs + "'/>"
        company_address.innerHTML = "<input type='text' id='address_mod' value='"
                + company_addresss + "'/>"
        document.getElementById("project_staff");
        html = '<a href="#" id="grey_dbbtn_date" onclick="editusets()">确认修改</a>';
        grey_dbbtn_date.innerHTML = html;
        bb=bb+1

    }
    if (bb != 1) {
        alert(";;;");
        usernames_mod = $('#usernames_mod').val();
        Office = $('#project_mod').val();
        company_mod = $('#company_mod').val();
        company_web_mod = $('#company_web_mod').val();
        address_mod = $('#address_mod').val();
        lis = document.getElementById('project_mod');
        lis.innerHTML = "<span class='fleft1' id='usernames_admin'>'"
                + usernames_mod + "'</span>";
        var grey_dbbtn_date = document.getElementById("grey_dbbtn_date");
        grey_dbbtn_dates = $('#grey_dbbtn_date').text();
        html = '<a href="#" id="grey_dbbtn_date" onclick="editusets()">资料修改</a>';
        grey_dbbtn_date.innerHTML = html;
        alert(";;;");

    }

}
为什么 我这代码执行了,但总会回到第一个判断里执行一次 好奇怪
搜索更多相关主题的帖子: function javascript 
2014-04-17 00:26
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
得分:0 
function editusets() {
    var bb = 1;
    ...;
}

这样赋值后肯定会执行的
2014-05-03 09:11
cai410579517
Rank: 3Rank: 3
来 自:宁德
等 级:论坛游侠
威 望:6
帖 子:128
专家分:179
注 册:2013-8-18
得分:0 
但是要点击两次 才执行
2014-05-28 16:02



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




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

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