Posts

JavaScript returning NaN value -

i have 2 ui-slider, , have calculation on slide callback, it's returning nan value $( document ).ready(function() { $("#amount").slider({ range: "min", value: 160000, min: 10000, max: 400000, step: 1, slide: function(event, ui) { var interest = 0.0325; var amount = parseint(ui.value); var temp1 = amount * (interest / 12) / (1 - math.pow(1 + (interest / 12), -(years * 12))); $('#currentamount').val(amount); $('#monthly').text(math.round(temp1)); } }); $("#years").slider({ range: "min", value: 8, min: 1, max: 12, step: 1, slide: function(event, ui) { var interest = 0.0325; var years = parseint(ui.value); var temp1 = amount * (interest / 12) / (1 - math.pow(1 + (interest / 12), -(years * 12))); $('#yearsval').text(years); $('#monthly').text(math.rou...

javascript - how do I copy and paste images in php -

how copy , paste uploaded images in php. when click on copy button copy uploaded images. when click on paste button paste copy image using javascript , php <script type="text/javascript"> function clicked(){ var src = document.getelementbyid('copy').value document.getelementbyid('paste').value = src; } </script> html: <ul id="image_list"> <li><img src="elements/1.png" id="copy" width="640px" height = "480px" /></li> </ul> <button onclick="clicked();"> copy </button> check this, should you. else asked question way. search first, please. :) <script> function copy() { if(window.clipboarddata) { window.clipboarddata.cleardata(); window.clipboarddata.setdata("text", document.getelementbyid('txtacpy').value); } } function paste() { if(window.clipboarddata) { document.getelementbyid('txtapaste...

javascript - How to Filter the value pasted in TextArea -

have text area enter semicolon separated values, able process keyboard events , validating successfully.how validate same on copy paste. $(function () { var kpi = document.getelementbyid('<%=this.d.clientid%>').value; var tb = $('#<%= textbox.clientid %>'); $(tb).keypress(function (e) { var regex = new regexp("[0-9;]+$"); var str = string.fromcharcode(!e.charcode ? e.which : e.charcode); if (regex.test(str) && !($(this).val().match(/;{2,}/))) { var = $(this).val().match(/;/ig) || []; var len = as.length; if (len < kpi) { return true; } } e.preventdefault(); return false; }); $(tb).keyup(function (e) { var str = string.fromcharcode(!e.charcode ? e.which : e.charcode); if (($(this).val().match(/[;]{2,}/g))) { var shortenedstring = $(this).val().substr(0, ($(this).val().length ...

How to convert xml response using curl into array then store in database using php -

i invoking php curl method on server , response xml type. curl saving output (after removing tags) in scalar type variable. there way store in database it's easy parse? <response status="ok" responsetime="10"> <results> <wirelineservices> <blockfips>360775908001027</blockfips> <frn>0007556251</frn> <providername>time warner cable llc</providername> <doingbusinessas>time warner cable</doingbusinessas> <holdingcompanynumber>131352</holdingcompanynumber> <holdingcompanyname>time warner cable inc.</holdingcompanyname> <providerurl>www.timewarnercable.com</providerurl> <technologies> <technologycode>40</technologycode> <typicaldownloadspeed>0</typicaldownloadspeed> <typicaluploadspeed>0</typicaluploadspeed> <maximumadvertiseddownloadspeed>9</maximumadvertiseddownloadspeed> <maximumadvertiseduploadspeed...

ios - AFNetworking background downloading automatically stop after some time, I need to resume it -

i using afnetwork (its base on nafdownloadrequestoperation) , task in downloading multiple zip files 1 one amazon bucket. when app in foreground every thing working well, when app goes in background mode time downloading running time , automatically stop. read blog in following method called before downloading stop. [self.operationupdate setshouldexecuteasbackgroundtaskwithexpirationhandler:^{ nslog(@"downloading stop"); }]; problem in background mode downloading automatically stop what want : if downloading stop in background , when app again comes foreground need resume downloading point. i use following code in appdelegate not understand how resume previous downloading. __block uibackgroundtaskidentifier backgroundtaskidentifier = [application beginbackgroundtaskwithexpirationhandler:^(void) { [application endbackgroundtask:backgroundtaskidentifier]; nslog(@"applicationwillresignactive"); [__se...

javascript - Any way to create a "state" listener instead of an "event" listener? -

i know can add click or change listener on checkbox. handler changes disabled prop of button true when checkbox unchecked. that's easy. but rather having event-driven, there way have "state" driven? if "state" of checkbox unchecked, "state" of button disabled. doesn't matter kind of event triggers state change. if checkbox in 1 state, button in corresponding state. that's it. here's example of standard event-driven code checkout button should disabled long terms , conditions checkbox unchecked. $('input[name="terms-and-conditons"]').change(function(e, tmpl){ if(e.target.checked === true){ $('#checkout-button').prop("disabled", false); } else { $('#checkout-button').prop("disabled", true); }; }); unfortunately doesn't take account initial states, since requires event happen else happen. on page load, if checkbox unchecked, button still ena...

javascript - Slicknav autoclosing multilevel menus -

i'm working slicknav mobile menu. came across cool little way have parent menu close automatically if click on parent menu , have working if i'm using below (please note, not know javascript. see me hacking other code i've found online): <ul id="menu"> <li class="first"><a href="#">parent1</a> <ul> <li><a href="#" title="">child1</a></li> <li><a href="#" title="">child2</a></li> </ul> </li> <li><a href="#" title="">parent2</a> <ul> <li><a href="#" title="">child3</a></li> <li><a href="#" title="">child4</a></li> </ul> </li> <li><a href="#" title="...