Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts

    alert not working on firefox

    hi ,

    i have this simple file , its working on IE but not on firefox

    Code:
    <html>
    <body>
    
    
    <input type=button id='button1' value='Mark paid' onclick='javascript:alert();'>
    
    <input type=button id='button2' value='Mark paid' onclick='alert();'>
    </body>
    </html>
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    um, do not use javascript: in the event handlers. not needed.

    When you look at the error console, are you seeing any errors? Reason you are not supplying a value inside the alert?

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts
    Nothing appears at the error console . But when i add alert("jj") , its working.
    I was just testing my script step by step by placing alert to find the error

    But the empty alert box was running on apera and IE .

    whats the other main diff between FF and IE .

    someone told me that FF cares about empty space between tags. What difference can that make in my scripts
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Simply Mozilla will not alert nothing, which seems reasonable. alert() method needs an argument by all means.
    Quote Originally Posted by o0O0o.o0O0o
    whats the other main diff between FF and IE .
    There are a lot of differences between FF and IE. There are many differences between all the browsers (IE, Moz, Opera, Safari...) and between the same browser's versions. Too many to be posted here.
    Quote Originally Posted by o0O0o.o0O0o
    someone told me that FF cares about empty space between tags. What difference can that make in my scripts
    Yes. FF takes all the empty spaces between tags as empty textNodes in DOM tree, while IE takes only some of them. That should be considered when circle through the childNodes of a parent or when some reference methods are used (nextSibling(), previousSibling()) That means you should check for the nodeType of an element to be sure it is a tag or a textNode.

    Ex, referring the next tag sibling
    Code:
    var nextS=element.nextSibling;
    while(nextS.nodeType!=1){
    nextS=nextS.nextSibling;
    }
    Last edited by Kor; 04-29-2008 at 08:29 AM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Hmm looking at ur code, and picking something from net:

    http://www.thewatchmakerproject.com/...revioussibling

    But it does not work. why ?


    Code:
    Object.prototype.previousObject = function() 
    { 
      var nextS=this.previousSibling;
      while(nextS.nodeType!=1)
      {
        nextS=nextS.previousSibling;
      }
      return nextS;
    };
    forinstance, something like this:

    Code:
     alert(sender.parentNode.previousObject);
    returns:

    var nextS=this.previousSibling;
    while(nextS.nodeType!=1)
    {
    nextS=nextS.previousSibling;
    }
    return nextS;
    Last edited by BubikolRamios; 08-31-2008 at 10:26 AM.

  • #6
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by o0O0o.o0O0o View Post
    hi ,

    i have this simple file , its working on IE but not on firefox

    Code:
    <html>
    <body>
    
    
    <input type=button id='button1' value='Mark paid' onclick='javascript:alert();'>
    
    <input type=button id='button2' value='Mark paid' onclick='alert();'>
    </body>
    </html>
    if you are asking for why it doesn't work i dont think i can help you but wouldnt a simple fix (yes very simple) be
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function disp_alert()
    {
     alert("INSERT THE ALERT INFO HERE");
    }
    </script>
    </head>
    <body>
    
    
    <input type=button id='button1' value='Mark paid' onclick='disp_alert();'>
    
    <input type=button id='button2' value='Mark paid' onclick='disp_alert();'>
    
    </body>
    </html>
    if all you wanted it to do was display an alert box at the touch of a button. please correct me if i have completely misunderstood lol.


  •  

    Posting Permissions

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