unwanted page reload

Discussion in 'HTML' started by julian_m, May 18, 2006.

  1. julian_m

    julian_m Guest

    After double-clicking the link the browser wants to reload the page,
    even though there is not any link at all.
    It doesn't happen if I change the "ondblclick" event to "onclick"

    <a href="" ondblclick="show_div('the_div_3'); return false;">Div 3</a>
    <div style="display: none;" id="the_div_1">This is div 1</div>

    The javascript function is really a basic one...

    <script type="text/javascript">
    function show_div(div_id) {
    document.getElementById(div_id).style.display = 'block';
    }

    </script>


    Any hint?

    regards- julian
    julian_m, May 18, 2006
    #1
    1. Advertising

  2. julian_m

    Neredbojias Guest

    To further the education of mankind, "julian_m" <>
    vouchsafed:

    > After double-clicking the link the browser wants to reload the page,
    > even though there is not any link at all.
    > It doesn't happen if I change the "ondblclick" event to "onclick"
    >
    > <a href="" ondblclick="show_div('the_div_3'); return false;">Div 3</a>
    > <div style="display: none;" id="the_div_1">This is div 1</div>
    >
    > The javascript function is really a basic one...
    >
    > <script type="text/javascript">
    > function show_div(div_id) {
    > document.getElementById(div_id).style.display = 'block';
    > }
    >
    > </script>


    It's 'cause you have an empty href.

    Do:

    <a href="javascript:void(0)" ondblclick="show_div('the_div_3'); return
    false;">

    --
    Neredbojias
    Infinity has its limits.
    Neredbojias, May 19, 2006
    #2
    1. Advertising

  3. julian_m

    julian_m Guest

    Neredbojias wrote:
    > To further the education of mankind, "julian_m" <>
    > vouchsafed:
    >
    > > After double-clicking the link the browser wants to reload the page,
    > > even though there is not any link at all.
    > > It doesn't happen if I change the "ondblclick" event to "onclick"
    > >
    > > <a href="" ondblclick="show_div('the_div_3'); return false;">Div 3</a>
    > > <div style="display: none;" id="the_div_1">This is div 1</div>
    > >
    > > The javascript function is really a basic one...
    > >
    > > <script type="text/javascript">
    > > function show_div(div_id) {
    > > document.getElementById(div_id).style.display = 'block';
    > > }
    > >
    > > </script>

    >
    > It's 'cause you have an empty href.
    >
    > Do:
    >
    > <a href="javascript:void(0)" ondblclick="show_div('the_div_3'); return
    > false;">
    >

    Great, thanks.

    It's strange what happens with (click != dblclick) though

    regards - julian
    julian_m, May 19, 2006
    #3
  4. julian_m

    Neredbojias Guest

    To further the education of mankind, "julian_m"
    <> vouchsafed:

    >> > After double-clicking the link the browser wants to reload the
    >> > page, even though there is not any link at all.


    >> It's 'cause you have an empty href.
    >>
    >> Do:
    >>
    >> <a href="javascript:void(0)" ondblclick="show_div('the_div_3');
    >> return false;">


    > Great, thanks.
    >
    > It's strange what happens with (click != dblclick) though


    The href picks up the click before the double-click, and when empty reacts
    in browser-specific ways.

    --
    Neredbojias
    Infinity has its limits.
    Neredbojias, May 19, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sanjay patil via .NET 247

    Previous(Unwanted) event handled when page refreshed by key F5

    sanjay patil via .NET 247, Apr 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    388
    sanjay patil via .NET 247
    Apr 27, 2004
  2. Joshua Beall
    Replies:
    26
    Views:
    219,880
    AndreiKaa
    Jun 29, 2007
  3. Blue Streak

    Unwanted frame refresh/reload...

    Blue Streak, Jun 6, 2006, in forum: HTML
    Replies:
    3
    Views:
    1,165
    Adrienne Boswell
    Jun 7, 2006
  4. gen_tricomi
    Replies:
    2
    Views:
    722
    gen_tricomi
    May 23, 2006
  5. Stefan Mueller
    Replies:
    4
    Views:
    278
    Stefan Mueller
    Nov 5, 2005
Loading...

Share This Page