1,330 Posted Topics
Re: Joban, Do I understand correctly the the XML is requested with an AJAX call, then acted on client-side to build out/replace some section of the DOM? If so, then you will need to post sample XML and give some idea of the HTML you want to build otherwise I could … | |
Re: Minitauros, From your description, there appears to be no need for two separate ajax actions. By returning the updated list data (or a null response for failure) from the "delete" action, you can drive both div1 and div2 from a single response handler. If you really want to have two … | |
Re: Ashishjannela, If I understand correctly, then you need to read [URL="http://code.google.com/apis/maps/documentation/javascript/basics.html#Geolocation"]this[/URL]. [B]Airshow[/B] | |
Re: Ivan, It may have been done with [ICODE]<img src="myLowsrcURL" lowsrc="mySrcURL" />[/ICODE], but lowsrc was never officially adopted by the W3C. Cross-browser support for lowsrc is therefore probably poor (I have not used it for years) but by all means try it. Alternatively you can use [ICODE]<img src="mylowSrcURL" onload="this.src='mySrcURL';" />[/ICODE], which … | |
Re: Anirban, To keep it simple, don't use a popup. Instead, create the fields on the same page as the original form. For example, they can be inserted in a <div></div> element. It is generally more user-friendly to generate one extra field at a time, so the user does not need … | |
Re: As vibhadevit says, eval() should do the job. It should be executed inside a [ICODE]try{...} catch(error){...}[/ICODE] block because the user input is not guaranteed to be good JavaScript. Airshow | |
Re: I think the problem is that when $("#" + this.value) selects nothing, then (by definition) no siblings are available to be found, so this approach will never work for the first (null) option, even when all the "available", "in route", "dropped", "delivered" divs are in place. You have to think … | |
Re: Dasatti, You could try hard-coding the <form ...></form> then deliver/insert just its contents. If that doesn't work then hard code the whole form and show/hide it and change its properties/contents with DOM methods as necessary. [B]Airshow[/B] | |
Re: Azegurb, I have had a hack at your code and in the process come to the conclusion that you might consider something slighly different. Namely : [LIST] [*]a single select menu, from which items are added to the table, and which is much easier to manage than one select menu … | |
Re: First, get [URL="http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/1565923928"]JavaScript: The Definitive Guide, but David Flanagan[/URL]. Once you have absorbed everything in the book and put it into practise, then read and watch everything available by [URL="http://javascript.crockford.com/"]Douglas Crockford[/URL]. I found his stuff very good after I had been writing JavaScript for a few years. It wouldn't have … | |
Re: I can tell you in principle how to do this. First add <markerset>...</markerset> wrappers around each set. You can give each set attributes to describe it, eg.: <markerset type="summary" name="summary">...</markerset> <markerset type="section" name="Pantera">...</markerset> <markerset type="section" name="Rammstein">...</markerset> Now, you have something that the javascript can read/interpret to display the markers in … | |
Re: Client-side should have no problem achieving this. Just make sure that you are not using any global variables that are common to both processes. (Even better, use no globals at all). Server-side is more of a concern. If the first process is CPU intensive, then you are maybe expecting a … | |
Re: Himit, First, construct your HTML like this: [CODE] <table id="myTable" border> <tr><th>appid</th><th>appname</th><th>appver</th></tr> <tr><td class="appid">100</td><td class="appname">App 1</td><td class="appver">1.1</td></tr> <tr><td class="appid">200</td><td class="appname">App 2</td><td class="appver">2.2</td></tr> <tr><td class="appid">300</td><td class="appname">App 3</td><td class="appver">3.3</td></tr> </tr> </table> [/CODE] By giving the tds classes, they can be tested/addressed in javascript: Simple: [CODE] $(function(){ $("#myTable tr").click(function(){//click anywhere in a row … | |
Re: Rom, That's caused by event propagation. In other words, the click is firing a click event in the div underlying the checkbox. This can't be cured with either not()or :not because it isn't a question of jQuery selection. Instead, you have to specifically inhibit the click from propagating downwards, like … | |
Re: All very confused Gambit. Let's try for some decomposition: GAMBIT: I have approached this problem by first trying to store the selected value ($("sel_source_zero").value()) into a PHP variable using AJAX. I am trying to use $.ajax() function from jQuery appended to Drupal, but I'm not sure how to approach this. … | |
Re: Dschuett, Like this: [CODE]function ajaxFunction(docId){ var ajaxDisplay = document.getElementById('basic-modal-content'); if(!ajaxDisplay) { return false; }//no point continuing if the display div doesn't exist var ajaxRequest; // The variable that makes Ajax possible! try { // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e) { // Internet Explorer Browsers … | |
Re: If, as the code in nextImage implies, you propose to use jQuery, then the door is open to doing this far more efficiently than with onclick handlers in the HTML. For example, [ICODE]$items = $("li.lightbox a")[/ICODE] selects all the links in the unordered list. You then have a jQuery object … | |
Re: pHouse, You may just need to add <?xml version="1.0"?> to the start of the xmlOutput string to make it recognisable as xml. If you want, you can try doing the server-side code in jQuery instead of raw javascript. It will simplify considerably to something like: [CODE] function startRequest(parentId){ var $comments … | |
Re: I generally avoid inline divs because of effects like this. Try [ICODE].portlet { ... float:left; ...}[/ICODE] instead. You may need to set left/right margins to get the correct spacing. And remember to set whatever comes next in the HTML to [ICODE]clear:left[/ICODE] or [ICODE]clear:both[/ICODE] to prevent it floating. If floats won't … | |
Re: Genzoman, try: [CODE] $('a.closediv').each( function(e){ $(this).bind('click', function(e){ $(this).closest("div.countystats").hide(250); return false; }); }); [/CODE] [B]Airshow[/B] | |
Re: Sunny, A pretty standard validation pattern is as follows: [CODE] <script> $j = jQuery.noConflict(); $j(document).ready(function(){ function validation(){ var rtnVal = true;//assume true until any field validator indicates false. // fullname validation rtnVal = rtnVal && is_field_empty($j('#fullname'), $j('#full_name_err_msg')); // other validations here //rtnVal = rtnVal && ......... return rtnVal; } function … | |
Re: Penguino, That's CSS, not Javascript. [B]Airshow[/B] | |
Re: Depending on DOCTYPE, Eclipse has the right to be picky over badly formed HTML. Assuming XHTML, attributes should be in "double quotes". This may fix it: [CODE=HTML]<form action="MyServlet" method="post">[/CODE] [B]Airshow[/B] | |
Re: Eternity, First, the code will simplify to : [CODE] $(document).ready(function () { $("#logoimg").hover( function () { $(this).attr("src", "Media/imgover.png").animate({ width: 420 }, 300); }, function () { $(this).attr("src", "Media/imgout.png").animate({ width: 400 }, 300); }); }); [/CODE] Secondly, did it work locally then stop working after FTPing to a remote host? If … | |
Re: BaSk, To make the animations happen in cascade, not in parallel, you need to use a callback function as one of the arguments to animate(). By having the callback function perform a recursive call to your outer function [ICODE]menuItemsIn[/ICODE], you get a chain reaction that animates each list item in … | |
Re: newbiwJS, There's a nmber of ways to write the code. Here's a simple version: [CODE] var ask = true; while(ask){ var employName = prompt ("Please enter the employee's name" , ""); if (employName === null) {//user cancelled ask = false; break; } else if (employName !== '' && isNaN(Number(employName))) { … | |
Re: Funkyash, You have created am HTML element with id="bmi" to receive the calculated value. The javascript attempts to put the calculated value into an element with id="txtHint", which doesn't exist. As there's no safety in the code, a javascript error will be thrown. [B]Airshow[/B] | |
Re: Kgizo, "next page" and "ajax" are mutually exclusive. It's either one or the other. Which do you want? [B]Airshow[/B] | |
Re: Lifeworks, Try : [CODE] ... if(links[x].getAttribute('rel') == 'link_category') ... [/CODE] Or do the whole thing in one line with jQuery : [CODE] function get_product_categories_links(){ return $('a[rel=link_category]').toArray(); } [/CODE] [B]Airshow[/B] | |
Re: bkimbriel, Why seven functions and seven templates? You could do everything you want with one function and one template, each flexible enough to handle any day. You do need seven containers (divs), one per day, each identifyable by id, to which the newly created elements can be appended. Currently everything … | |
Re: Vishalkhialani, I wonder if it's because the images are wider than the column width? Try experimenting by setting all the images to 185px or less. [B]Airshow[/B] | |
Re: Klemme, As far as I can see, you just need to know how to submit the form you have created. This is done with a submit button : [CODE] <form action="edit_page.php" method="post"> <select class="boxstyles" name="linklabel"> <option>Choose a page to edit</option> <option value="linklabel_1">Title 1</option> <option value="linklabel_2">Title 2</option> <option value="linklabel_3">Title 3</option> </select> … | |
Re: Dave, You need to fix something else first. I'm using Opera here. The tabbed popups are displaced half-offscreen to the left. The tabs don't show. It's may be a question of screen size rather than browser of course. I'm at 1024 x 768. [B]Airshow[/B] | |
Re: Lit108, Off the top of my head, I expect you can dynamically create an invisible link, which emulates a facebox link, then emulate that link being clicked, all in one line of jQuery. This line needs to be wrapped in a couple more lines to cause it to fire when … | |
Re: MDanz, You are into some murky areas of browser behaviour there, where nothing is guaranteed. You can give it a chance by making sure that the url is always unique at each form submission. Using method="get" (as opposed to "post") will tend to have this effect but the url will … | |
Re: Dave, You need to select by ID, and you can leave class="popup" there. It's explained in the [URL="http://www.gethifi.com/blog/a-jquery-plugin-for-zoomable-interactive-maps"]documentation[/URL]. See section 2 "HTML Data". [B]Airshow[/B] | |
Re: Maddie, You probably just need a couple of standard lines of code for cross-browser compatibility. [CODE] function move(evt){ evt = evt || window.event; var target = evt.target || evt.srcElement; ... [/CODE] | |
Re: Andrew, If each group of five elements has a common container (eg. a div, p or tr), then you can try this: Identify everything with classes instead of ids. [LIST] [*]Give #change... elements eg. class="change" [*]Give #cancel... elements eg. class="cancel" [*]Give #...Display elements eg. class="display" [*]Give #...Change elements eg. class="change2" … | |
Re: Rajeesh, Try this: [CODE=javascript] function slide() { var $slider = $("#slider"); var pos = $slider.position().left; if(pos>-5400) { $slider.animate({"left":"-=600px"},300); } else { $slider.animate({"left":"0px"},600); } } $(document).ready(function() { var s = setInterval(slide, 3000); }); //if the sliding starts too early, then try instead of the statement in $(document).ready(...) onload = function() { … | |
Re: kekkaishi, Here's a couple of ways to do what you want. First the HTML - it's best to use class rather than id as the selector, to avoid duplicate ids when we use [ICODE]jquery.clone()[/ICODE]. [CODE=HTML] <div id="content"> <input class="inpu" type="text" /><!-- no need for a counter --> </div> [/CODE] One … | |
Re: Bkim, If I understand correctly then help is readily available in the form of a "combobox". This is a pulldown menu into which the user can also type his own entry - a hybrid form element. HTML doesn't provide native comboboxes but you can employ one of several javascript libraries … | |
Re: Drako, Try sanitizing your pages by opening them in Notepad (or other simple text editor, definately not MS Word or Wordpad) then "save as ...". Browse the sanitized copies. Any change? Another possibility is to try UTF-16. [B]Airshow[/B] | |
Re: Typically you see readyState == 0 when you are "file browsing", ie relying on the operating system to serve the files rather than employing a proper HTML server. If you use a desktop PC as your development environment, then the most realistic option is to install Apache or Microsoft IIS. … | |
Re: Samson, I think I understand. You have a set of little forms running down the page. These forms are identical in function but not content. Each form is to be submitted by ajax (not regular HTML form submission). On successful completion of the ajax, an <li> element is to be … | |
Re: Ankurmawanda, A script tag with `src="..."` cannot also contain its own code. You need a separate script tag. <script type="text/javascript" src="md5.js"></script> <script type="text/javascript"> function crypt() { document.form1.password.value = calcMD5(document.form1.password.value); } </script> Then it should work but you won't see it happen because the form will be submitted and the page … | |
Re: AJLX, The code becomes a bit simpler if you pass in a reference to the input element (form field) itself rather than its value (str). [CODE] //replace function showHint(str){ ... } //with function showHint(inputElement){ var str = inputElement.value; ... } [/CODE] Now you still have easy access to the field's … | |
Re: Ello, I would have to guess that the function is working fine but there's no variation in behaviour each time your "#generate-quote" element(s) are clicked. [LIST] [*]The url is always "generator.php" [*]The data is aways {act: 'char_con'} [*]The callback function always sticks the response into ".quote" element(s). [/LIST] Unless something … | |
Re: Acute, `$(sel).click(...)` attaches functionality only to matching elements that exist when the command is executed. Use $(sel).[live](http://api.jquery.com/live/)(...) to attach functionality to existing matching elements *and* any future elements that also match sel. **Airshow** | |
Re: Still_, I've not seen that before and am not aware of any browser that disables javascript in that way - it would be completly inappropriate. I can only guess "disabled-" is being inserted by the server (whichever one you use, Apache, Microsoft IIS etc). Has someone been playing with server … | |
Re: "Pseudoprotocol" (or "pseudo protocol") is sometimes used as a synonym for "javascript url", ie. a link of the form :- [CODE] <a href="javascript:do_something();">Click Me</a> [/CODE] This form should not be used as it is not supported by all browsers. You have two options :- [CODE=html] <a href="#" onclick="do_something(); return false">Click … |
The End.