如何在jsp中div中添加勾选框,且选中和不选中的按钮不同,

2025-05-11 20:52:45
推荐回答(3个)
回答(1):





main.html

div.left_topnext2 {
background: url(r1.png) 0px 4px no-repeat;
height: 20px;
line-height: 20px;
}

div.left_topnext2 a {
padding-left: 16px;
}


onload = function ()
{
var divs = document.getElementsByTagName('div');
for ( var i = 0; i < divs.length; i++)
        {
        var me = divs[i];
        me.clicked = 0;
        if (me.className == 'left_topnext2')
            {
            me.onclick = function ()
            {
             me.style.backgroundImage = me.clicked == 0 ? 'url(r2.png)' : 'url(r1.png)';
             me.clicked = me.clicked == 1 ? 0 : 1;
            }
            }
        }
}




专题报道


回答(2):

单选:
学生
教师
管理员
复选框:
苹果 桃子
香蕉

回答(3):

checkbox 啊 添加上去就有了 样式自己弄弄