Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering text

Status
Not open for further replies.

Enkrypted

Technical User
Sep 18, 2002
663
US
We have a script in place on our website and inside the script is code to display text in a popup window. Each page has the following call function for the script

Code:
        function ModalPopupsAlert99() {
            ModalPopups.Alert("jsAlert99",
                "Click on any of the 4 ways to contact us!!",
                "", 
                {
                    okButtonText: "Close",
                    loadHTMLFile: "contact_us_box.html",
                    width: 410,
                    height: 500
                }
            );
        }

The text above "Click on any of the 4 ways to contact us!!" is the text we are trying to get center aligned. It is currently aligned to the left of the popup box.

I noticed something in the main javascript file that has a section for that particular area

Code:
     //Support function to create all layers
    _createAllLayers: function(id, title, message, parameters) {
        //Create all 6 layers for; BackGround, Popup, Shadow, PopupTitle, PopupBody, PopupFooter
        var oBackground = ModalPopupsSupport.makeLayer(id+'_background', true, null);        // 0
        var oPopup = ModalPopupsSupport.makeLayer(id+'_popup', true, null);                  // 1
        var oShadow = ModalPopupsSupport.makeLayer(id+'_shadow', true, null);                // 2
        var oPopupTitle = ModalPopupsSupport.makeLayer(id+'_popupTitle', true, oPopup);      // 3
        var oPopupBody = ModalPopupsSupport.makeLayer(id+'_popupBody', true, oPopup);        // 4
        var oPopupFooter = ModalPopupsSupport.makeLayer(id+'_popupFooter', true, oPopup);    // 5

The rest of the javascript file can be viewed at:


I've contacted the author of the script regarding this and they have provided a couple solutions that had no help and I have not heard anymore from them, so I am turning to the experts here at Tek-Tips for assistance.

I've tried putting that line of text in a div wrapper, but that did not help it at all. If anyone can help me out, it would be greatly appreciated. Thanks!

Enkrypted
A+
 
untested but try
(I roll my own dialogs.)
Code:
    Alert: function(id, title, message, parameters) {
        //Get parameters
        parameters = parameters || {};
        if(!title) title = "Alert";

        //'Alert' specific parameters
        parameters.buttons = "ok";
        parameters.okButtonText = parameters.okButtonText != null ? parameters.okButtonText : ModalPopupsDefaults.okButtonText;

        //Create layers
        var myLayers = ModalPopups._createAllLayers(id, title, message, parameters);
        var oPopupBody = myLayers[4];
        
        //'Alert' specific setup of Body
        oPopupBody.innerHTML = message;
        [COLOR=red]oPopupBody.style.textAlign = 'center';[/color]

        //Style all layers        
        ModalPopups._styleAllLayers(id, parameters, myLayers);
    },
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top