
jsp弹出页面问题
现在有个按钮,点击后onclick一个方法方法里面打开一个新页面window.open("<%=request.getContextPath()%>/index.jsp"...
现在有个按钮,点击后onclick一个方法
方法里面打开一个新页面
window.open ("<%=request.getContextPath()%>/index.jsp");
问题是 我打开这个新页面后,顺便把id=1 的那块div bgcolor 变色,这个怎么写?求代码 展开
方法里面打开一个新页面
window.open ("<%=request.getContextPath()%>/index.jsp");
问题是 我打开这个新页面后,顺便把id=1 的那块div bgcolor 变色,这个怎么写?求代码 展开
1个回答
展开全部
window.onload = function ()
{
document.getElementById("【id】").style.backgroundColor = "【颜色】";
}
{
document.getElementById("【id】").style.backgroundColor = "【颜色】";
}
追问
郁闷,我是有个下啦列表 很多值,
1
2
function s(id){
if( id ==1 ){
如果id=1 弹出新页面,让那个页面的id=1 的div变色
}else if(id ==2){
}
}
追答
那首先你的open的时候需要把这个这个参数传过去。
window.open ("/index.jsp?targetEleId=1");
window.onload = function ()
{
var targetEleId = "";//得到select选择的id值
if("1" == targetEleId )
{
document.getElementById("【id】").style.backgroundColor = "【颜色】";
}
}
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询