SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please Help Me !!

    Hi All,


    I got a java script which is used in VB forums and I want to use this effect in a normal HTML page, but I really want some modifications on the script

    the script is:

    HTML Code:
    <script type="text/javascript" language="JavaScript">
    <!--
    function log_out()
    {
      // You can change 30 and 0.3 to suit your 'tastes' :)
      bo = document.getElementsByTagName('body');
      bo[0].style.filter = 'Alpha(opacity="30")';
      bo[0].style.MozOpacity = '0.3';
      bo[0].style.opacity = '0.3';
    
      if (confirm('Are you sure you want to log out ??'))
      {
        return true;
      }
      else
      {
        bo[0].style.filter = 'Alpha(opacity="100")';
        bo[0].style.MozOpacity = '1';
        bo[0].style.opacity = '1';
    
        return false;
      }
    }
    //-->
    </script>
    As you can see the Msg "Are you sure you want to log out ??" I want to remove this Msg and show the effect without asking anything, just when I put it in my page it'll show me the effect

    Can anyone help me here ??


    Waiting a reply, & Thanks

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Change this:

    Code javascript:
    if (confirm('Are you sure you want to log out ??'))
    {
        return true;
    }
    else
    {
        bo[0].style.filter = 'Alpha(opacity="100")';
        bo[0].style.MozOpacity = '1';
        bo[0].style.opacity = '1';
     
        return false;
    }

    to this:

    Code javascript:
    bo[0].style.filter = 'Alpha(opacity="100")';
    bo[0].style.MozOpacity = '1';
    bo[0].style.opacity = '1';
    return false;

    They won't be able to log out though, which might hamper some things.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,


    Thanks a lot for your reply, I tried this:

    HTML Code:
    <script type="text/javascript" language="JavaScript">
    <!--
    function log_out()
    {
      // You can change 30 and 0.3 to suit your 'tastes' :)
      bo = document.getElementsByTagName('body');
      bo[0].style.filter = 'Alpha(opacity="30")';
      bo[0].style.MozOpacity = '0.3';
      bo[0].style.opacity = '0.3';
      bo[0].style.filter = 'Alpha(opacity="100")';
      bo[0].style.MozOpacity = '1';
      bo[0].style.opacity = '1';
      return false;
    }
    //-->
    </script>
    No effect happend at all !!

    Can you tell me whats wrong ??


    Waiting your reply

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Yes, the function is setting the opacity then setting it again to something else.
    Try this:

    Code javascript:
    function log_out()
    {
      // You can change 30 and 0.3 to suit your 'tastes' :)
      bo = document.getElementsByTagName('body');
      bo[0].style.filter = 'Alpha(opacity="30")';
      bo[0].style.MozOpacity = '0.3';
      bo[0].style.opacity = '0.3';
      return false;
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •