开发者

JSF Pop-ups; can I set their location?

开发者 https://www.devze.com 2023-03-30 17:50 出处:网络
I\'ve been hunting for an answer, but I am something of a Java Neophyte, and may be using the wrong keywords for what I\'m looking for.I\'m using JSF (2.0), and attempting to spawn a popup window, def

I've been hunting for an answer, but I am something of a Java Neophyte, and may be using the wrong keywords for what I'm looking for. I'm using JSF (2.0), and attempting to spawn a popup window, defined to a specific location (I.e., Top Left Corner, or X/Y down from it, etc.) About the only option I see so far is centering it.

Is there any easy w开发者_C百科ay to do this without adding in some outside tool? An argument when I spawn it? Or setting it to somehow move itself once created?

Thanks!

Here's a sample of what I'm using now:

            <TABLE width="900">
                <tr><td>
                     <input type=button onclick="javascript:openwindow()" value="Add Something via a Popup"> 
                   </td>
                <tr>
            </TABLE>    

Followed by:

function openwindow() 
{ 
    var retRows = window.showModalDialog("<%=request.getContextPath()%>/jsp/SpecInfo.jsp",parentRows,"dialogHeight: 500px; dialogWidth: 860px; center: Yes; help: No; resizable: No; status: no; toolbar: no; resizable: no; scrollbars: no;");
    if( retRows ){
        for( i = 0; i < retRows.length; i++ ){      
            document.getElementById("spec_item_f"+(i+1)).value = retRows[i].spec_item_f;
            document.getElementById("spec_item_i"+(i+1)).value = retRows[i].spec_item_i;
            document.getElementById("spec_itemb_f"+(i+1)).value = retRows[i].spec_itemb_f;
            document.getElementById("spec_itemb_i"+(i+1)).value = retRows[i].spec_itemb_i;
            document.getElementById("spec_itemc_f"+(i+1)).value = retRows[i].spec_itemc_f;
            document.getElementById("spec_itemc_i"+(i+1)).value = retRows[i].spec_itemc_i;
            parentRows[i] = retRows[i];
        } 
    }
} 


Okay, you're using window.showModalDialog(). According to the linked MDC docs you can use dialogleft and dialogtop options for this. You'll perhaps only remove the center option.


Unrelated to the concrete problem, that javascript: pseudoprotocol is unnecessary. Remove it.

0

精彩评论

暂无评论...
验证码 换一张
取 消