把菜单栏和右键屏蔽掉,存OPEN的第二个参数对象

解决方案 »

  1.   

    可以使用#userdata<HTML>
    <HEAD>
    <STYLE>
    .storeuserData {behavior:url(#default#userData);}
    </STYLE>
    <SCRIPT>
    function fnSaveInput(){
    var oPersist=oPersistForm.oPersistInput;
    oPersist.setAttribute("sPersist",oPersist.value);
    oPersist.save("oXMLBranch");
    }
    function fnLoadInput(){
    var oPersist=oPersistForm.oPersistInput;
    oPersist.load("oXMLBranch");
    oPersist.value=oPersist.getAttribute("sPersist");
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM ID="oPersistForm">
    <INPUT CLASS="storeuserData" TYPE="text" ID="oPersistInput">
    <INPUT TYPE="button" VALUE="Load" onclick="fnLoadInput()">
    <INPUT TYPE="button" VALUE="Save" onclick="fnSaveInput()">
    </FORM>
    </BODY>
    </HTML>
      

  2.   

    试了一下,ice_berg16(寻梦的稻草人)的方法可以在刷新后保存具体的值,但是保存对象还是没成功,代码如下:
    storeuserData的style已经添加
    function fnSaveInput()
    {
        var newWnd = window.open("Default2.aspx");
        var theInput = form1.Text1;
        theInput.setAttribute("sPersist", newWnd);
        theInput.save("oXMLBranch");
    }
    function fnLoadInput()
    {
        var newWnd;
        var theInput = form1.Text1;
        theInput.load("oXMLBranch");
        newWnd = theInput.getAttribute("sPersist");
        newWnd.close();
    }<form id="form1" runat="server">
        <input id="Text1" type="text" class="storeuserData" /><br />
        <input id="ButtonSave" type="button" value="save" onclick="fnSaveInput()" />
        <input id="ButtonLoad" type="button" value="load" onclick="fnLoadInput()" />
    </form>
    是不是不能用Text1的属性来保存对象?如果不能保存对象而保存窗口名称,怎么通过窗口名称来关闭窗口呢?
      

  3.   

    /**
    *
    *要实现在用户点击“退出”的时候通过枚举Array中记录的窗口对象来关闭它们
    *
    */
    楼主是否用的是框架,这个“退出”是你自定义的,还是浏览器上自带的?
    为什么不可以一次关闭?
    另一方面可以试试,cookie;
    或者
    通过下面的方法,你可以取得你打开的每一窗口的对应值,再进行后续操作:
    var count = new Object();
    count.win0 = "open0";
    count.win1 = "open1";
    count.win2 = "open2";function openIt(i)
    {
    alert(count[head+i]);
    }</script>
    </HEAD><BODY>
    <button onclick="openIt(0);">open 0</button>
    <button onclick="openIt(1);">open 1</button>
    <button onclick="openIt(2);">open 2</button>
    </BODY>
    </HTML>
      

  4.   

    没有使用框架,包含"退出"的是A页面,A页面根据用户的操作弹出了很多新的窗口(window.open弹出,便于用户对比查看),要实现的是当用户点击A中的退出按钮时,把用户曾经打开的所有窗口都关闭,而其它的窗口相安无事.
    暂时想由JS来实现,因为窗口是JS window.open打开的,现在的问题是如果A没刷新过,那么我可以根据曾经每次window.open返回的对象B来把这些窗口关闭,代码运行良好,但是如果A页面刷新过(无论reload还是postback)后,曾经存储的那些窗口对象就消失了,我也就无法关闭这些窗口了.暂时只知道关闭窗口用window.close(),所以现在考虑的是如何在刷新后还能维持窗口对象B,不知道有没有办法根据弹出窗口时设定的名字来关窗口的,毕竟A和这些弹出窗口间还是有opener关系的.曾进考虑过在A中设立标志,然后在每个弹出页面中定时检测opener的该标志来决定是否关闭,但是这样的话会增加系统负担,我也不可能取挨个为每个弹出页面添加定时脚本....苦恼啊