-1
我禁用了a.html中的按钮和b.html中的某个xyz按钮。 单击b.html中的xyz按钮时,应启用a.html中的禁用按钮。从另一个jsp文件访问按钮属性
我想这2天以来,但没有得到你可以帮助我。
我禁用了a.html中的按钮和b.html中的某个xyz按钮。 单击b.html中的xyz按钮时,应启用a.html中的禁用按钮。从另一个jsp文件访问按钮属性
我想这2天以来,但没有得到你可以帮助我。
如果两个不同的文件没有任何关系,你不能直接将其禁用。相反,您可以在学生的数据库中维护一个标志变量来跟踪信息。根据其价值启用和禁用。
如果只是纯html页面,您可以使用jQuery/ JavaScript
来做到这一点。下面是一个简单的例子:
a.html:
<body>
<input id="aButton" type="button" value="A Button">
<script type="text/javascript">
$(document).ready(function() {
var enableAButton=getUrlParameter("enable");
if(enableAButton == "true"){
$('#aButton').prop('disabled', false);
}else{
$('#aButton').prop('disabled', true);//disabled by default
}
});
function getUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
</script>
</body>
b.html:
<body>
<input id="bButton" type="button" value="B Button">
<script type="text/javascript">
$("#bButton").click(function(){
window.location.href="a.html?enable=true"
});
</script>
</body>
您是在'b.html'里面加载'a.html',反之亦然。它们如何链接? – 2015-02-10 08:37:07
你应该提供你已经尝试过的代码。解释什么不能按预期工作,以及出现的任何错误消息(如果有的话)。 – Zaphod 2015-02-10 08:40:53
a.html是学生界面,b.html是教师界面。当教师点击他的按钮时,学生的按钮应该启用。我没有做任何加载,我刚刚创建了2个html文件。 – 2015-02-10 10:02:27