Js confirm box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pratimapaudel
    New Member
    • Jul 2007
    • 24

    Js confirm box

    Is there any way to change the text in Ok and Cancel in Javascript confirm box?
    Instead of OK and Cancel i want checkout and continue shopping.

    I have my js code like this
    [CODE=javascript]function CheckWt()
    {
    var backorder = 'False'

    if (backorder == 'False')
    {
    if (parseInt(docum ent.getElementB yId('ctl00_Main Content_Shoppin gCart1_ThemeSho ppingCart1_lblB alWeight').inne rHTML) > 0)
    {
    var ans = confirm('You have not reached your weight limit yet.\nClick "OK" if you would like to add more items to your cart. Click "Cancel" to proceed to checkout'); if (ans )
    {
    return false;
    }
    else
    {
    return true;
    }
    }
    else
    {
    return true;
    }
    }
    else
    {
    alert('Please Update the Quantity of the items that exceeds the available stock\nOr Click On Update To Stock Button ');

    return false;
    }
    }[/CODE]
    Last edited by gits; Mar 31 '08, 08:38 PM. Reason: added code tags
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Not really. You can using a pop-up window or a dynamically created layer and insert what ever buttons/content you want.

    Comment

    • pratimapaudel
      New Member
      • Jul 2007
      • 24

      #3
      Thanks for answer
      But how do i create layer dynamically?

      Comment

      • pronerd
        Recognized Expert Contributor
        • Nov 2006
        • 392

        #4
        Originally posted by pratimapaudel
        how do i create layer dynamically?
        There are two ways :

        1. The easy way is to have the layer in the page with its display attribute set to none so it will not be shown. You can then use JavaScript to set its display attribute to either 'block' or 'inline' to make it visable when you want it to be displayed.


        [HTML]<HTML>
        <div id="hiddenLayer " style="position : absolute; top: 150px; left:150px; display: none;" >Hey look its the hidden layer</div>
        <input type="button" id="showLayer" label="ShowLaye r" onClick="showTh eLayer()" />
        <script>
        function showTheLayer() {

        var layer = document.getEle mentById('hidde nLayer');
        layer.style.dis play ='block';
        }
        </script>
        </HTML>[/HTML]




        2. The other way would be to use the DOM API to create the DIV elements and then add them to the page. This is much more involved. You can google for specific examples.

        Comment

        Working...