1,330 Posted Topics
Re: Could be the line feed in the ...googleapis/jquery... url. If that doesn't fix it, try this: [CODE] $(document).ready(function(){ $('#charts li').each(function(){ var $this = $(this); var pc = Math.max(0, Math.min(100, parseInt($this.attr('title'), 10))); var len = $this.width() * pc / 100; $this.find('.percent').html(pc + '%').end().find('.bar').animate({width:len}, 1500); }); }); [/CODE] I haven't really changed … | |
Re: No. Javascript manipulates CSS properties to achieve its effects. Please mark solved topics as Solved even if the answer is not what you wanted to hear. There's a link somewhere near the bottom of the page. [B]Airshow[/B] | |
Re: There's no point involving javascript if you don't have to. Standard HTML hyperlinks are good for most site navigation menus. Use CSS to make them pretty. Use javascript for pullout/dropdown sub-menus or other effects that cannot be achieved with CSS. [B]Airshow[/B] | |
Re: Vignesh, Making multiple handles is easy : [CODE]$(function() { $mySlider = $( "#slider-range" ); $mySlider.slider({ // range: true,//don't set range min: 0, max: 1000, values: [ 75, 125, 175, 225 ], slide: function( evt, ui ) { a = []; for(var i=0; i<ui.values.length; i++) { a.push(ui.values[i]); } $( "#amount" ).val( … | |
Re: [QUOTE=ddymacek;1714268]try to assign your get function to a variable... [CODE] function test() { var data data = $.getJSON('singleday.php?dld='+ id+'&chkdag=' + 1, function(json) {sday=json}); OtherFunction(data); } function OtherFunction(data) { for (var i in sday) { // do somthing } } [/CODE][/QUOTE] I'm afraid that won't work because $.getJSON returns jqXHR, not … | |
Re: Sounds like a typesetting error by the book's publishers. Some natural languages (eg. Greek, Russian) use angled quotes but, as far as I know, no computer languages - certainly not js. [B]Airshow[/B] | |
Re: jQl, For each image you want to have this behaviour, give it a class (below I use [iCODE]someclass[/iCODE]), then attach the behaviour as follows: [CODE] $('img.someclass').click(function(){ var $row = $(this).closest('tr'); alert('Row id: ' + $row.attr('id')); }); [/CODE] [ICODE].closest()[/ICODE] is safer than [ICODE].parent()[/ICODE] and increasingly safer than [ICODE].parent().parent()[/ICODE] etc. as there … | |
Re: Hiyatran, It's easier with a [ICODE]found[/ICODE] variable inside the outer loop to track of whether the inner loop has found the current x[i]. [CODE=javascript] function getValue(id){ var x = ["a","b","c","d","e"]; var y = ["a","b","3","d","e"]; var i, j, found, notFound = []; for(i=0; i<x.length; i++){ found = false; for(j=0; j<y.length; j++){ … | |
Re: What are you using to do the sorting? Some code would be useful. | |
Re: Tower-Rounder, Thoughts, nothing definitive ..... As far as I am aware, browser-based javascript interpreters don't do any optimisation; they simply execute exactly what you wrote in the way you wrote it, warts and all. Other incarnations of javascript, eg NODE, may be different but I have no specific knowledge. The … | |
Re: Be sure to [ICODE]return true;[/ICODE] when execution drops through the validation trap(s) otherwise the returned value is falsy and the form will not sumbit. | |
For several days now, Daniweb pages are appearing here with most if not all images missing, eg. DANIWEB in the masthead, avatars, topic status icons, editor icons (except [ICODE], which I know was a recent addition). Facebook and Twitter logos are OK. Right-click>reload image has no effect. The problem appeared … | |
Re: Aaron, Assuming this [URL="http://plugins.jquery.com/project/Cookie"]cookie plugin[/URL] is installed, I think you want something like this: [CODE] $(document).ready(function(){ var $widget_FB = $("#widget_FB"); $('#Facebook').click(function(){ var checked = $(this).is(':checked'); $widget_FB[checked?'show':'hide'](); $.cookie('Facebook', checked?1:null);//session cookie for current path. //$.cookie('Facebook', checked?1:null, {expires:7});//peristent 7-day cookie. //$.cookie('Facebook', checked?1:null, {path:'/'});//cookie for all paths in the domain. }); $widget_FB.find('a.close').click(function(){ $('#Facebook').click(); }); … | |
Re: Phoenix, First (unlikely but simple), check that the filename on the server has a lower case .js extension. After that it's likely to be a character encoding issue. If so then it could be caused at any of the following levels: [LIST] [*]Keyboard - some language settings generate odd codes. … | |
Re: Just how many versions of this question are there? | |
Re: Aaaaaagh, yet another version of the same question!!! Pleeeeeease, just one. | |
Re: How does this differ from your earlier question to which I provided a response? [B]Airshow[/B] | |
Re: Malcolm, You need two groups of buttons, _A (alphabetic) and _B (boolean), and you need to hide those you don't want to show. For A,B,C buttons: [CODE] $('.answerBtns_A').each(function(index){ (index < clickedNumber) ? $(this).show() : $(this).hide(); }); $('.answerBtns_B').hide(); [/CODE] For true/false buttons: [CODE] $('.answerBtns_A').hide(); $('.answerBtns_B').show(); [/CODE] [B]Airshow[/B] | |
Re: Leon, [QUOTE=talisien;1707939]How do I create an javascript array from json?[/QUOTE] It depends entirely on what is JSON-encoded server-side. If you get the php script right then it should be as simple as: [CODE] $.getJSON('checkDates.php?dld='+id, function(json){$myBadDates=json;}); [/CODE] To achieve this, return a JSON-encoded php array of "start" dates. [B]Airshow[/B] | |
Re: Carl, I haven't got time to give a full answer but here are some pointers: [LIST] [*]The current value of your first select element is given by [iCODE]optionDrop[0][optionDrop[0].selectedIndex].value[/iCODE]. [*]Select elements are [iCODE]display:inline[/iCODE] by default so, unless you specifically want "block", use [iCODE]numberDrop[0].style.display = "inline";[/iCODE]. [*]Dynamically manipulating a select element's options … | |
Re: "Like two text boxes" or genuinely two text boxes? | |
Re: Virangya, Unless you need to specifically exclude elements in the document's head, then you can simplify to [iCODE]$('div[class^="suf-"]');[/iCODE]. But as they point out in the jQuery documentation, this form of selector is slow (because internally jQuery has to use a regExp). It's better to separate out the prefix "suf" as … | |
Re: JSON encoding is unnecessary here because regular GET or POST serialisation will do the job. Simply use jQuery's [iCODE]form.serialize()[/iCODE] method to encode all fields in the form. [CODE] $(document).ready(function() { $('#submit').click(function(e){ e.preventDefault(); $.ajax({ url: "save.php", type: "POST", data: $(this.form).serialize(), success: function(result){ alert(result); } }); }); }); [/CODE] If necessary you … | |
Re: Behseini, Other than the screen, cookies and making HTTP requests, client-side javascript has no output capabilities. Specifically, it cannot read/write files other than the afore-mentioned cookies (which are severely constrained). Any amount of jQuery isn't going to help. So even if you could get javascript to generate a "pdf string", … | |
Re: Iinviktus, First, the HTML: [CODE=HTML] <a href="#" class="imgSwap"><img src="path/to/image/far_east_button.gif" class="buttonImage" /></a> <a href="#" class="imgSwap"><img src="path/to/image/middle_earth.gif" class="buttonImage" /></a> <a href="#" class="imgSwap"><img src="path/to/image/europe.gif" class="buttonImage" /></a> [/CODE] Then, buttonData: [CODE=javascript] var buttonData = [ //titles added {src:'fareast.gif', href:'http://google.com', title:'Far East'}, {src:'middlearth.jpg', href:'http://yahoo.com', title:'Middle Earth'}, {src:'europe.jpg', href:'http://chappo.cc', title:'Europe'} ]; [/CODE] Then, the click handler: … | |
Re: [QUOTE=pbracing33b;1702262]Does JavaScipt methods work with any web page elements?[/QUOTE] Yes, assuming you mean browser-borne javascript, then you could say that its sole raison d'etre is to work with web page elements. This is implicit in maybe +95% of everything written on javascript. Another incarnation of javascript, [URL="http://nodejs.org/"]NODE[/URL], also works with … | |
Re: "em" is the width of an "M" in whichever font is being used (or browser's default font if nothing overrides it). There are at least two things wrong in your code: [LIST=1] [*][ICODE]left[/ICODE] and [ICODE]top[/ICODE] have no meaning unless the element to which they are applied also has [ICODE]position:absolute[/ICODE] or … | |
Re: Hi Aze, If I understand the question correctly ... The condition [iCODE]if (ip && ip.value.replace(/\D/g,'')!='')[/iCODE] exploits the "protective" characteristic of logical operartor [iCODE]&&[/iCODE]. [iCODE]&&[/iCODE] protects its right argument by not testing it and returning [iCODE]false[/iCODE] immediately if the left argument is falsy. This is safe coding and good practice even … | |
Re: Aze, The code appears to be a nonsense. I would be surprised if it works. [ICODE]imageItem[/ICODE] is a constructor function designed to preload images. It returns the src (location) of the image that it preloads. However the function [ICODE]get_ImageItemLocation()[/ICODE] assumes that [ICODE]imageItem[/ICODE] has returned an object. The whole thing should … | |
Re: Animated gif or animated sprite as Troy III suggests. [I]Attached gif was made here: [url]http://tools.dynamicdrive.com/animatedgif/[/url][/I] [B]Airshow[/B] | |
Re: Where is [iCODE].sortable()[/iCODE] called in the tabbed page? | |
Re: Easiest way is to write the hrefs like this: [CODE=HTML] <a href="update.php?q=text1">text 1</a> <a href="update.php?q=text2">text 2</a> [/CODE] Then read [iCODE]$_GET['q'][/iCODE] in php (or the equivalent in other server-side languages) and build your SQL accordingly. [B]Airshow[/B] | |
Re: You could try this approach: [CODE] function getDiscount(x, containerId){ var menu = document.getElementById('discount_code'); var container = document.getElementById('containerId'); if(menu && container){ var discount = Number(menu[menu.selectedIndex].value)/100;//option value must be "15", not "SE15". container.innerHTML = x * (1 - discount); } } [/CODE] Then control the detailed behaviour by supplying suitable arguments where … | |
Re: That approach can be made to work but it is generally considered better to attach event handlers in javascript rather than HTML. [CODE=php] <?php if(isset($_POST['bu'])){ $data = 'text <a href="#">alert</a>'; echo $data; } ?> [/CODE] [CODE=javascript] function getdatafromfile(){ var bu = 'bu'; $.ajax({ type: 'POST', url: 'phpfile.php', data: {bu: bu}, … | |
Re: You should be able to do something like this : [CODE=javascript] $(document).ready(function(){ $('#sidebar .head').each(function(){ var $this = $(this); var key = $this.html(); var action = $.cookie(key) ? 'slideDown' : 'slideUp'; $this.next('ul')[action]('fast'); }).click(function(){ var $this = $(this); var key = $this.html(); $this.next('ul').slideToggle('fast', function(){ $.cookie(key, $(this).is(':hidden')); }); }); }); [/CODE] [I]untested[/I] [B]Airshow[/B] | |
Re: I understand that hentPosition() works when urlKey() is omitted but it's not clear - does urlKey() work when hentPosition() is omitted? By the way [iCODE]this.value[/iCODE] will not work for select elements in all browsers. [iCODE]this[this.selectedIndex].value[/iCODE] is the cross-browser solution. [B]Airshow[/B] | |
Re: 1. Back up your local copy of the source. Burn it to CD for safe keeping. 2a. Use an FTP client to uploaded the source in its current state. The Godaddy site provides a help on FTP upload. 2b. If the files include .sql exports then there's a good chance … | |
Re: Anjibman, This may not be exactly what you want but should get you started. First put the report HTML in a div wrapper and convert it to a template with spans in each place you want to insert text, like this: [CODE=HTML] <div id="http_report"> <h1>HTTP Status: <span class="status"></span> - <span … | |
Re: [QUOTE=3thal;1695437]ooh I'm so sorry , but I'm new here and i thought that if the solution doesn't work just click on down arrow ![/QUOTE] What a giggle :icon_cheesygrin: I appreciate the misunderstanding. Glad to see we're all friends again :icon_cool: [B]Airshow[/B] ![]() | |
Re: Oblo10, document.write() can only be used during the document load phase. Any attempt to use document.write() after the [ICODE]window.onload[/ICODE] event has fired (or thereabouts) will cause the whole document (doctype, head, body - EVERYTHING) to be overwritten, as you have seen. For this reason, document.write() is not the right approach … | |
Re: Mcwebalizer, Please post your source for the popup window - HTML and any javascript that you have already written. Also, need to know the id of the textarea in the main document. [B]Airshow[/B] | |
Re: You have a long road ahead of you. [LIST=1] [*]Learn HTML [*]Learn javascript [*]Learn jQuery [*]Write Calculator [/LIST] Ask specific question along the way. [B]Airshow[/B] | |
Re: PERMISSION DENIED normally arises from like a cross-domain issue, which would be like something outside the code you like posted, like. [B]Airshow[/B] | |
[B]Environment[/B] Development: Amazon EC2 instance. Operational: Unknown at this time [B]Scenario[/B] This is a *nix question but things start out in php, so please bear with me. I'm trying to get php script (php_script_1) to to run another php script (php_script_2) in the background. This will allow php_script_1 to complete … | |
Re: Parsing out a URL's query string is quite simple if you approach it th right way. My [URL="http://www.daniweb.com/web-development/javascript-dhtml-ajax/code/217357"]QueryParser()[/URL] will save you a lot of heartache. Not only does it parse out the query string but also includes a bunch of useful methods, and it only puts a maximum of two … | |
Re: JemZ, No point going into great detail here - someone has done a great review: [URL="http://www.designlabelblog.com/2009/03/20-ways-to-create-javascript-modal.html"]20+ ways to create javascript modal windows and dialog boxes[/URL] [B]Airshow[/B] | |
Re: [QUOTE=Troy III;1675325]The working group on xhtml is discontinued. They've dropped it completely.[/QUOTE] This needs to be qualified Troy. "The working group on xhtml is discontinued" - True. The W3C XHTML working group's charter lapsed in 2010. "They've dropped it completely" - False. The reason that the XHTML working group's charter … | |
Re: Poor smartness - advice overload I expect ...... ..... but please let me join in. This code: [LIST=1] [*] will validate as many [U]independent[/U] groups of checkboxes as you like. [*]will, on failure to validate : [LIST=a][*]set a message in an HTML element of your choosing (by id), for each … |
The End.