SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Thread: Problem in IE6

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem in IE6

    I am developing a web app in php with help from javascript. But in IE6, javascript function is not being called after clicking a button. I have tried a lot to tackle the problem but eventually I have to land up here...

    Here is the code I am using

    Code:
    <input type='image' src='button.jpg' id='button' name='name'   onclick='A();'/>
    And javascript code is

    Code:
    function a()
    {
    alert('Output');
    }


    I have tried a lot of things after googling but nothing worked out. Nothing happens after clicking the button though it works in FF, Chrome. Can anyone help me...

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kz13 View Post
    I am developing a web app in php with help from javascript. But in IE6, javascript function is not being called after clicking a button. I have tried a lot to tackle the problem but eventually I have to land up here...
    The code you posted should not work in any browser. Post a live URL.
    Tab-indentation is a crime against humanity.

  3. #3
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Your function name is different from the name your calling, IE is very sensitive to case types so if you simply change your onclick A(); to a(); it should work fine.

  4. #4
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am really sorry for a() and A(). It was a spelling mistake. Perhaps please check out Walknshine.com.

    Go to login button.It will call out javascript function in chrome, FF but not in ie6.

    I hope I am clear now.

    the code is

    Code:
    <input type='image' href="" src='login-button.jpg' id='button' name='login_user' value='Login'  onclick='a();'/>
    
    
    function a()
    {
    alert('wefwef');
    }
    Can anyone suggest me anything??

  5. #5
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Your problem is something that happens from time to time and is very hard to pick up on, in your script you have the following function.

    Code:
    function act_update(para, page) {
    
      var myurl = page + '?' + para;
     
      $("#notice_div").html('Loading..'); 
      $.ajax({
        type: 'GET',
        url: myurl,
        success: function(data) {
          $(act_div).html(data).fadeIn("slow");
          $("#notice_div").html(''); 
    //      window.setTimeout(update, 10000);
        },
       
    });
    }
    I have made the error bold and red so you can see it, what happens is in IE when it says a comma that's not supposed to be there it automatically ends the script there and then while other browsers have been designed to read the code no matter if there's a stray comma. To fix the error simply remove that comma and it should work fine after that.

  6. #6
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SgtLegend View Post
    Your problem is something that happens from time to time and is very hard to pick up on, in your script you have the following function.

    Code:
    function act_update(para, page) {
    
      var myurl = page + '?' + para;
     
      $("#notice_div").html('Loading..'); 
      $.ajax({
        type: 'GET',
        url: myurl,
        success: function(data) {
          $(act_div).html(data).fadeIn("slow");
          $("#notice_div").html(''); 
    //      window.setTimeout(update, 10000);
        },
       
    });
    }
    I have made the error bold and red so you can see it, what happens is in IE when it says a comma that's not supposed to be there it automatically ends the script there and then while other browsers have been designed to read the code no matter if there's a stray comma. To fix the error simply remove that comma and it should work fine after that.
    No....sorry it didnt work out...even after removing comma...it was not working in FF or chrome...any other suggestion??

  7. #7
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Are you 100% sure you updated your javascript.js file as i viewed your source again and nothing has changed.

  8. #8
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SgtLegend View Post
    Are you 100% sure you updated your javascript.js file as i viewed your source again and nothing has changed.
    I changed and and then rechanged to same one as I needed to login...okk...I am changing or removing the comma...

  9. #9
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Sorry but you changed the wrong function, what you need to do is revert the change for the function you removed the comma in as that had no issues. Next find the act_update function which starts on line 234 and end on line 249. Inside that function you will find the stray comma which needs to be removed as per my previous post.

  10. #10
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry but that also did not work...u can see what I have changed....

    I have even commented over there // removed comma 2

  11. #11
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I looked at your source and i kept missing the main issue, in your file you have act_update repeated about 3-4 times which is a simple oversight, if you remove the repeats the errors should go away and everything should work fine.

  12. #12
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SgtLegend View Post
    I looked at your source and i kept missing the main issue, in your file you have act_update repeated about 3-4 times which is a simple oversight, if you remove the repeats the errors should go away and everything should work fine.
    Thank you very for solving my problem....

  13. #13
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,189
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    No problem, glad to help.


Tags for this Thread

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
  •