SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)

    Firebug: Step through code on event, not refresh?

    Hallo,

    I have some half-working script I'm playing with that I half-understand (this is the real problem) which I'm having troube debugging because it always does work when I refresh.

    So whenever I step through my functions with Firebug everything does what I expect it to do: but if then I re-invoke my onchange event, not every step is taken and it's hard to see why because I can't "see" what it's doing after the page has loaded and the script run at least once.

    This is for hide-and-show in a form and all the other versions I see online are even less understandable than what I've got so far. So I figure I'd better debug the one I have.

    Anyone know how to re-watch a script onevent?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,077
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    I'm not really sure what you're asking here. What do you mean by "refresh"? Refresh the page?
    And what do you mean by re-invoke event?

    I'd also be happy to take a look at the code if you posted that by the way.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,817
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Have you tried running it through the debugger built into Opera/Safari/Chrome/IE8 to see if it does the same thing there or whether the problem is specific to Firefox.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    I'm not really sure what you're asking here. What do you mean by "refresh"? Refresh the page?
    Yes.
    And what do you mean by re-invoke event?
    I have some stuff tied to an event: onchange. onchange is not doing everything it should, but refreshing the page with the change in values in place works.

    Have you tried running it through the debugger built into Opera/Safari/Chrome/IE8 to see if it does the same thing there or whether the problem is specific to Firefox.
    The only thing that's Firefox specific is that Firefox allows your choice in a select drop-down to remain chosen even after refresh; other browsers reset the value to the first in source (I don't have a "selected" attribute in there now). For those browsers the only way to test "refresh" with different values was to manually switch their order in the HTML. (IE also keeps your choice o refresh)

    Everyone (Dragonfly always goes grey on me and I can only restart it by restarting Opera; IE8 I need to boot up another machine and I expect nothing I write to work in IE anyway so I save the bad news for later) seems to be showing steps working the same way, when the script first runs. It's doing what I want. It's checking every possible value.

    But when I make a change (when I click my select and change the value), the script doesn't run again, it just executes (so I can't "see" what it's doing). And it executes incorrectly. I was hoping there was a way to "see" what it was doing to find out why it was doing it differently when the event actually fires vs on first load.

    If there isn't then that's fine: I'll have to probably rewrite everything until it gets down to a level of simplicity I can understand and then see if I can get it working in any browser. Was just wondering if there was a way to watch events firing.

    Scallio: if you want to see it, it's here but since it seems I'll have to completely rewrite it, there may not be anything there when you go to look (js is under js folder with a funclib and begrafenis.js).

  5. #5
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    After a bunch of hard coffee and more staring at the code until my eyes glazed, I think I see what it's doing and why it's not doing what I want with the event. Will post the code I've got in another thread and ask.


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
  •