hmm, a have tried this <a class="ToggleClose" id="ToggleClose<?= $did ?>" href="descriptionsadd.php?add=2&did=<?= $did ?>&showhtml=2"></a> <script type="text/javascript"> $('a#ToggleClose<?= $did ?>').click(function(){ buildingedit('#descr', 'descriptionsadd.php', 'did', <?= $did ?>, 2,this); return false; }); </script>
it's working, but is it what you mean by Inline JavaScript On Feb 11, 7:43 pm, mkmanning <michaell...@gmail.com> wrote: > Inline JavaScript is generally frowned upon nowadays. A better > approach, if you can do it, is to separate your behavior from your > markup, the same as you separate your structure from your > presentation. It makes for cleaner, more accessible, and more > maintainable code. For the example above: > > //attach behavior in your jQuery domready function > ... > $('a.ToggleClose').click(function(){ > buildingedit('#descr', 'descriptionsadd.php', 'did', <?= $did ?>, 2, > this); > return false; > > }); > > As you've most likely seen with CSS, this separation has many > advantages relating to purity and maintenance, and unobtrusive > Javascript tends to focus more on enhancing an existing, functional > interface. This subtle difference is important when you're talking > about graceful degradation/progressive enhancement. > > Just saying. :) > ... > On Feb 11, 9:26 am, brian <bally.z...@gmail.com> wrote: > > > 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>