打开某个页面后,如何在某些aspx页面中打开div? [英] How to open a div in some aspx page after that page is opened?

查看:67
本文介绍了打开某个页面后,如何在某些aspx页面中打开div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我有点怀疑,就像我有一些ASPX页面一样.
在Site.Master页面中,我有菜单,当我单击菜单项时,必须打开一些aspx页面,但是在打开该页面后,我想在该页面中打开一个div,默认情况下将其设置为display = none.

我已经尝试过使用jquery进行显示和隐藏吗?但可以打开该页面,但不能打开div.所以我试图在打开页面后更改class属性.我只想用javascript做.

这是我使用的代码

Hi friends, I have small doubt like I have some ASPX pages.
in Site.Master page I have menu in that when I click a menu item some aspx page has to open but after open that page I want to open a div in that page which is by default set display=none.

I have tried by show and hide using jquery? but able to open that page but not the div. so I have tried changing the class attribute after page is opened. i want to do in javascript only.

Here is my code that i used

var currentUrl = $(location).attr('href');
   //alert(currentUrl);
    var containsFoo = currentUrl.indexOf('Admin.aspx');
    alert(containsFoo);
    if (containsFoo!=-1) {
        $("#" + DivId).removeAttr('class', 'SearchDivOff');
        $("#" + DivId).attr('class','SearchDivOn');
    }
    else {
        window.open("Admin.aspx", "_self");
        $("#" + DivId).removeAttr('class','SearchDivOff');
        $("#" + DivId).attr('class','SearchDivOn');
    }



在这里,我检查了页面是否为Admin.aspx,然后打开了该div,或者先打开该页面,然后再打开特定的div.我的问题是,当我进入Home.aspx这样的其他页面时,我只是打开该页面,但无法打开该div.

我该怎么办?
在此先感谢
Ganesh



Here I have checked for that if the page is Admin.aspx if then open that div or else open that page first and then open particular div next. my problem is that when i am in some other page like Home.aspx I am just opening that page but not able to open that div.

how can I do this?
Thanks in Advance
Ganesh

推荐答案

(位置).attr(' href '); // alert(currentUrl); var containsFoo = currentUrl.indexOf(' Admin.aspx' ); 警报(containsFoo); 如果(containsFoo!=-1){
(location).attr('href'); //alert(currentUrl); var containsFoo = currentUrl.indexOf('Admin.aspx'); alert(containsFoo); if (containsFoo!=-1) {


(" #" + DivId).removeAttr( class'' SearchDivOff');
("#" + DivId).removeAttr('class', 'SearchDivOff');


(" + DivId).attr(' class'' SearchDivOn') ; } 其他 { window.open(" " _ self");
("#" + DivId).attr('class','SearchDivOn'); } else { window.open("Admin.aspx", "_self");


这篇关于打开某个页面后,如何在某些aspx页面中打开div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆