If you bind your event handlers using an element's onclick attribute
(or onwhatever) you should write it like so:

onclick="return myClickHandler(...);"

And return false from the function to avoid having the link followed.

Note that the attribute should be all lowercase, btw. The camelcase
version is used when referring to it as a member of a DOM element, eg.
some_element.onClick = ...

On Wed, Feb 11, 2009 at 9:28 AM, goldy <zlati.pehliva...@gmail.com> wrote:
>
> function buildingedit(searchhtmlid, filename, editid, idnum, addnum,
> obj)
> {
>        //closeinst(searchhtmlid);
>
>        var params = $.evalJSON('{'+editid+':'+idnum+',add:'+addnum
> +',showhtml:2}');
>        var myelem = document.getElementById('lastid');
>        var lastid = myelem.value;
>
>        var $tablerow = $(searchhtmlid+idnum).clone(true);
>
>        $(searchhtmlid+lastid).css('background-color','#FFFFFF');
>        if(lastid)
>        {
>                if(lastid!=idnum)
>                {
>                        $.get(filename,
>                                                params,
>                                                function(returned_data)
>                                                {
>
>                                                        var rs = $('<div 
> id="editwindow" style="display:none;"></
> div>');
>                                                        
> $(searchhtmlid+idnum).hide();
>                                                        
> $(searchhtmlid+idnum).after(rs);
>                                                        
> //$(searchhtmlid+idnum).css('background-color','#DCE4F5');
>                                                        
> $('#editwindow').css('background-color','#DCE4F5');
>                                                        rs.html(returned_data);
>                                                        rs.fadeIn(2000, 
> function(){
>                                                                        
> $(this).css('display','block');
>                                                                });
>                                                });
>
>                        myelem.value = idnum;
>                        setTimeout("prepareForm("+idnum+")", 2000);
>                }
>                else
>                {
>                        $('div#editwindow').fadeOut(1000, function(){
>                                                                               
>                                                                               
>    $(this).remove();
>                                                                               
>                                                                               
>    $(searchhtmlid+idnum).show();
>                                                                               
>                                                                               
>    });
>                        myelem.value = 0;
>                        //closeprev(obj);
>                }
>        }
>        else
>        {
>                $.get(filename,
>                                                params,
>                                                function(returned_data)
>                                                {
>                                                        var rs = $('<div 
> id="editwindow" style="display:none;"></
> div>');
>                                                        
> $(searchhtmlid+idnum).hide();
>                                                        
> $(searchhtmlid+idnum).after(rs);
>                                                        
> //$(searchhtmlid+idnum).css('background-color','#DCE4F5');
>                                                        
> $('#editwindow').css('background-color','#DCE4F5');
>                                                        rs.html(returned_data);
>                                                        rs.fadeIn(2000, 
> function(){
>                                                                        
> $(this).css('display','block');
>                                                                });
>                                                });
>
>                myelem.value = idnum;
>        }
>
>        return false;
>
> }
>
>
> and this is called here
>
> <a class="ToggleClose" onClick="buildingedit('#descr',
> 'descriptionsadd.php', 'did', <?= $did ?>, 2, this);"
> href="descriptionsadd.php?add=2&did=<?= $did ?>&showhtml=2" ></a>

Reply via email to