1,330 Posted Topics
Made a PayPal donation several days ago and am wondering at what point the adverts actually disappear? Getting rid of the ads is not exactly the most important thing in my life but it would be nice to know that the money got through. Come to think of it, I … | |
Re: [B]Indexed arrays[/B]: [iCODE].length[/iCODE] property is one greater than the highest index used. Sequentially indexed arrays can be traversed with [iCODE]for(var i=0; i<arr.length; i++){...}[/iCODE]. Sequentially and non-sequentially indexed (sparse) arrays can be traversed with [iCODE]for(var prop in arr){...}[/iCODE]. [B]Associative arrays[/B]: [iCODE].length[/iCODE] property stays at zero. Traverse with [iCODE]for(var prop in arr){...}[/iCODE]. … | |
Re: Yes, you can use try/catch but remember that this will only handle otherwise uncaught javascript errors. It won't handle socalled "silent failures" as can arise in jQuery which is, to a certain extent, error tolerant. For example, if jQueryUI was not installed on the page, then [ICODE]try { $('#myDiv').dialog('open'); }[/ICODE] … | |
Re: Troy, Have you found this: [url]http://perfectionkills.com/detecting-event-support-without-browser-sniffing/[/url] allowing tests of the type [iCODE]isEventSupported("eventname")[/iCODE]? isEventSupported won't, in itself, produce a list of events but might offer a way ahead. [B]Airshow[/B] | |
Re: Don't bust yourself guys. Original post was Dec 2004!!! [B]Airshow[/B] | |
Re: Jonnyboy12, In your original post, the problem is with [iCODE]onclick='work('word')'[/iCODE] which will throw javascript error due to single-quotes inside single-quotes. Try [iCODE]onclick="work('word')"[/iCODE]. You may like to consider [iCODE]onclick="work('word'); return false;"[/iCODE], which will completely suppress the <a> tag's natural href action. This is useful even with href="#". [B]Airshow[/B] | |
Re: Submit buttons are a feature of HTML, not javascript. They work in association with the <form>...</form> in which they are embedded. [LIST] [*]The form tag's [iCODE]action[/iCODE] attribute determines the URL that is requested [*]The form tag's [iCODE]method[/iCODE] attribute (GET or POST) determines how the form data (user inputs and selections) … | |
Re: I generally build query strings like this: [CODE=javascript] queryString = []; queryString.push('project_name=' + project_name); queryString.push('cat=' + val); queryString.push('prj_desc=' + project_desc); location.href = 'Add_New_Project.php?' + queryString.join("&"); [/CODE] Thus the line number in any js error message will be more specific than when the url is built in one line. [B]Airshow[/B] | |
Re: Anubhavk, Develop classnames and associated CSS directives to give the various visual effects you want. Test out your CSS with hard-coded HTML. Build your real table with : [LIST] [*]<table class="highlightTable"> [*]<td class="time"> (your time cell in each row) [*]<td class="aaaa"> (your other key data cell in each row) [/LIST] … | |
Re: Hi Aze, [QUOTE=azegurb;1736166][CODE] done:function(f){ postaction = f || postaction //remember user defined callback functions to be called when images load }[/CODE][/QUOTE] This is a very convenient javascript shorthand but use it with caution. In full (pseudocode) [LIST] [*]if(f is not falsy), then postaction = f; [*]if(f is falsy), then leave … | |
Re: Evan.., To understand what is going on here, you must first understand the tricky topic of [URL="http://jibbering.com/faq/notes/closures/"]closures[/URL]. In version A, each time it is called, [ICODE]function addMarker()[/ICODE] forms a closure containing its own [ICODE]marker[/ICODE]. In version B, there is only one closure formed by the outer scope (also a function … | |
Re: Asif, you have done 98% of the work and the final 2% is quite easy: Amend showRSS to accept a second argument: [CODE=javascript] function showRSS(url, containerId) [/CODE] Amend the line that inserts the ajax response into the document: [CODE=javascript] document.getElementById(containerId).innerHTML = xmlhttp.responseText; [/CODE] Now call showRSS twice, with different parameters, … | |
Re: The natural choice is [URL="http://code.google.com/apis/maps/index.html"]Google Maps[/URL]. It's API is public and well documented and the feature list is as long as your arm. [B]Airshow[/B] | |
Re: Violet, you're not lost at all, because everything you observe is correct. checkBounds() effects direction reversals by negating the deltas but the current iteration's deltas have already been applied, immediately before checkBounds() was called in moveSprite() (though the DOM has not yet been updated). The deltas are [U]not[/U] re-applied after … | |
Re: [CODE=javascript] setTimeout(calculate,1000); [/CODE] In a setTimeout() or setInterval() statement, either define an anonymous function or provide a reference to a named function, but (typically) [I]don't execute it[/I]. Execution happens when the time period has expired. "Typically" above: Javascript functions are first class objects. You might one day encounter a function … | |
Re: Pat, eval() :icon_eek: It's part of javascript but seldom needs to be used; arguably never. Number() returns a floating point conversion of its argument. [CODE] function doMath() { var one = Number(document.theForm.elements[0].value); var two = Number(document.theForm.elements[1].value); ans = one * two; outp = " " + "$" + ans.toFixed(2) + … | |
Re: Julia, The following will operate on any block element given [iCODE]class="maintain_aspect_ratio"[/iCODE] : [CODE=javascript] $(function(){ var $mar = $('.maintain_aspect_ratio'); $(window).resize(function(){ var $w = $(this);//or maybe $(document); var $this, height_ratio, width_ratio; $mar.each(function(){ $this = $(this); width_ratio = $this.width() / $w.width(); height_ratio = $this.height() / $w.height(); if (height_ratio > width_ratio){ $this.width("auto"); $this.height('100%'); } … | |
Re: Functions can call other functions, so you might want something like this: [CODE=javascript] function takeOrder(num) { var url=new Array(); url[0]="confirm.html"; var details = takeDetalis(num);//pass num in case takeDetails() needs it if(details){ window.location = url[num] + '?' + details; } } [/CODE] Where takeDetalis() is a function that displays a dialog … | |
Re: Helen, jStars isn't particularly well written. It's not in jQuery's currently preferred plugin pattern and allows nothing more than for the visual effect to be attached to an element. However, its lack of the means to remove it should not be an obstacle in this case because, as I understand … | |
Re: If you really want to know about emulating "classes" in javascript, then read [URL="http://www.crockford.com/javascript/inheritance.html"]this article[/URL] on Inheritance. I have read it every 3 months or so for the last 4 years in the hope that it will eventually sink in. [B]Airshow[/B] | |
Re: [url]http://javascript.open-libraries.com/utilities/drawing/10-best-javascript-drawing-and-canvas-libraries/[/url] | |
Re: [LIST] [*]Javascript does not allow a quoted string definition to be broken by line feeds. [*]There's no need to use [ICODE]eval()[/ICODE]. It should be fairly easy to find a work-around to avoid it. [*][ICODE]id[/ICODE] is undefined unless it is in an outer scope (eg the global scope). [/LIST] [B]Airshow[/B] | |
Re: If you Google "cant view my adsense ads", you will find that the syndrome is not exactly unique. I read through a few of the discussions but couldn't find a sensible, coherent diagnosis. [B]Bluish Smurf Airshow[/B] | |
Re: Hi Vizz, [iCODE]return false[/iCODE] from the click handler suppresses the natural hyperlink action of the clicked <a>. Try removing the statement or returning true. Most people do this sort of thing with CSS. [iCODE]#navlist a:active {...}[/iCODE] will style the clicked link but only while mouse is down. What you are … | |
![]() | Re: 1. In your browser, View Source of the served page. Is the source what you expect, with <%= myControl.xxxxx %> directives successfully substituted, and do these ids correspond to those of the element(s) in the HTML? 2. The current value of your <select> menu should be given by :- [CODE=javascript] … |
Re: I think the main problem is setting the opacity values to strings. Should be numeric values [ICODE]0.47[/ICODE], [iCODE]1[/iCODE] not [ICODE]"0.47"[/ICODE], [ICODE]"1"[/ICODE]. But there's another potential problem that css opacity values are not guaranteed, in all browsers, to read back from the DOM at exactly the same value they were set … | |
Re: Here's a jquery solutuon: [CODE=javascript] $(function(){ $r = $("#calculator").find("#result"); $ip = $("#calculator").find("#input"); $("#calculator").find("button").click(function(){ try{ $r.html( eval($ip.val()) ); } catch(e){ $r.html('Error'); } }).click(); }); [/CODE] [CODE=CSS] * { font-family:verdana; font-size:10pt; } #calculator { width:650px; padding:10px; border:2px solid #999; } #calculator input { margin-right:10px; } #calculator button{ margin-right:10px; } #calculator span { … | |
Re: Because that's what [ICODE].bold()[/ICODE] does - wraps a string in [ICODE]<b>...</b>[/ICODE] tags. Creating a WYSIWYG device is not trivial. Personally I would install something ready-written. [URL="http://www.tinymce.com/."]TinyMCE[/URL] is quite popular but it's certainly not the only one. [B]Airshow[/B] | |
Re: To all you guys trying to help Jahanas (OP), Reading between the lines, this is the scenario: [LIST] [*]OP has used Adobe ImageReady (not Photoshop I suspect) to slice up a screenshot, and used the "Save as HTML" option to save a <table>...</table> structure plus corresponding individual image slices. I … | |
![]() | Re: It's easier to pass a reference to the form element from the onclick handler. This avoids having to discover the form in the DOM with [ICODE]document.all[/ICODE], [ICODE]document.getElementById()[/ICODE], document.forms[] etc. [CODE=javascript]function multiply(form){ form.result.value = ((form.inputA.value * form.inputB.value * form.inputC.value * 150) / 1000000) ; } [/CODE] [CODE=HTML]<form action=""> <fieldset> <input type="text" … ![]() |
Can anyone explain the "Filter Below Quality Threshold" setting in the "Threads that match your interests" panel on the Daniweb home page. I'm sure it has some carefully considered logic behind it, but thus far impenetrable by yours truly. [B]Airshow[/B] | |
Re: I thought [iCODE]callback=?[/iCODE] was associated with jsonp, not json. | |
Re: If you mean [URL="http://www.adidas.com/home/uk"]this page[/URL], then the answer must be YES, because all the effects are already achieved with jQuery. If you mean [URL="http://www.adidas.com/my/homepage.asp"]this page[/URL], then mmmm, PROBABLY but there would be a lot of work in it. It's very imaginative. Maybe the flash author devised a generalised algorithm but … | |
Re: Method-chained jQuery executes left to right. There's no point setting a delay with nothing to its right; it won't affect anything to its left. You can try the following but it doubt it will work because .cookie() isn't in the effects queue or a custom queue. [CODE] $.delay(thisdelay).cookie("myppix", "<?php echo … | |
Re: Dauthutzen, You could approach this in several different ways depending on exactly what you are trying to achieve. One approach is to build HTML markup. Here's a couple of utility functions, plus a demo of how they might be used: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html … | |
Re: Try this, based on fobos' post : [CODE=javascript] onload = function(){ var field = document.getElementById('myField'); field.onkeyup = function(){ var val = parseInt(this.value); this.value = (!val) ? '' : Math.min(50,val); } } [/CODE] [CODE=HTML] <input type="text" id="myField" name="myField" maxlength="2" /> [/CODE] | |
Re: Easy, two choices: [LIST=1] [*]Don't replace the button, just change the properties of the existing button. [*]Attach the hover etc. functionality to the new button [/LIST] [B]Airshow[/B] | |
Re: pThu, You will find it easier to build the input element in a more jQuery way. There's no unique solution but something like this should work: [CODE] ... $input = $('<input type="text">').attr('id','txt'+j).focus(function(){ prePopulate(this.id, InfoArray, 'Hello', 'Hi'); }); $('#selectorName').after($input); ... [/CODE] You may want to pass [ICODE]this[/ICODE] to prePopulate() rather than … | |
Re: V, I expect jQuery chokes on a full document with <!DOCTYPE ...> and a <head> full of metas etc. Try stripping [iCODE]data[/iCODE] down to <body>...</body> before submitting it to jQuery. Stripping is best done with a regular expression, which you will need to develop or find. Searching the web for … | |
Re: Formal definitions don't always help to penetrate "closure", though they do make sense once you understand. If you learned about closures from PHP5, then you almost need to unlearn all that stuff first. PHP's implementation of closures is as bad and confusing as it gets (you actually need to use … | |
Re: On insertion of comma-separators numbers become strings, therefore for display purposes only. If further arithmetic operations are necessary, keep an unformatted, true Number representation of the original value in javascript. Approached the right way, you should never need to convert comma-separated number-strings back to true Numbers. [B]Airshow[/B] | |
Re: [QUOTE=hielo;1726664]If that is the case, it typically means that the server is not configured to execute php files.[/QUOTE] Or the file extension is wrong. Typically only .php files are sent to the php engine, but potentially any other extension. For Apache, this is established in httpd.conf. [B]Airshow[/B] | |
Re: eawade, Please forgive me if I'm wrong.. Whereas I've done lots of JSON, I only know about JSONP from what I have read. Things are made difficult in the jQuery documentation in that JSONP is detailed under "jQuery.ajax()" with only a scant reference under "jQuery.getJSON()". For me, the only scenario … | |
Re: How are you serving the documents? | |
Re: Yes, I think your problems are 99% to do with getting the HTML correct. As far as I can see jQuery.delegate() is at most a secondary issue. It's only necessary to use jQuery.delegate() if you need to attach javascript behaviour to dynamically inserted elements and even then, there are other … | |
Re: This is not a javascript issue. AV scanning is something to be performed/initiated by a server-side technology eg. PHP, PERL, JSP. [B]Airshow[/B] | |
Re: As one of the posters in itpragan's link says, it's better to use [URL="http://www.w3schools.com/jsref/jsref_obj_regexp.asp"]regular expressions[/URL] for these types of test. The "charAt" approach is bulky and not as capable. [B]Airshow[/B] | |
Re: Use spans, each with a unique id, for error messages: [CODE=HTML] Username: <input type="text" name="username" id="username_reg" /> <span id="username_msg"></span><br /> [/CODE] [CODE=javascript] validate(form){ rtnVal = true;//Assume true (OK) initially, then if one or more validation test yields false, false will be returned and the form will not be submitted. var username_msg … | |
Re: Maxxxx, You will get "back" failure in most (all?) major browsers except IE due to the fact that they re-render the page from a special "back/forward" cache (bfcache). This is desirable for rapid forward/back action but, incorrectly in my opinion, a select menu onchange event is also re-fired if (I … | |
Re: Difficult however you do it. The original was made with Adobe Flash. A javascript solution would not be so smooth. If you want it in a hurry then find a Flash expert. [B]Airshow[/B] |
The End.