Create File with Javascript
is it possible to create a file on localhost with javascript? ...
is it possible to create a file on localhost with javascript? ...
I've been trying to convert a UTC value in a string into a more readable format. To do that, I'm trying to parse the date using the Javascript Date.parse method. That however does not work on the input (eg:"2007-09-21T14:15:34.058-07:00") that i have. The end goal is to output a date string like "January 30th, 2008 @ 2:15PM". Any ideas?...
Hi, I know I should spend more time researching this and having a go before asking the question but I've got just 2 weeks to build a site with a portal style homepage (much like http://www.bbc.co.uk). I'm fairly good with jQuery and have played with jQuery UI draggables in the past but I was wondering if there were any tutorials or bes...
If I write a client-side Javascript app (with a little bit of server interaction), how can I prevent people from copying the Javascript files to their own site? Should I, at all? ...
Perhaps I'm just unaware of the competitors, but it seems when it comes to client-side scripting in the browser and DOM, Javascript is it. I know there's VBScript, but it really isn't even in the same ballpark as JS (not even cross platform, for starters). I'm just curious about how this came to be. Surely there would be a general desir...
Hi, i'm trying to get the return value of a javascript function(for example:return "hello") with iPhone SDK. On OS X the WebView method -stringByEvaluatingJavaScriptFromString: return a NSString containing the js function return value, but on the iPhone no value is returned. How can i solve? Thanks Marco ...
How to trim a string in javascript? ...
I'm placing content on my page through an ajax (post) request like so: $("input#ViewMore").click(function() { var data = { before: oldestDate, threadId: 1 }; $.post("/Message/More", data,function(html) { $('tbody#posts').prepend(html); return false; }, "html"); return false; }); with th...
How do you set the cursor position in a text field using jQuery? I've got a text field with content, and I want the users cursor to be positioned at a certain offset when they focus on the field. The code should look kind of like this: $('#input').focus(function() { $(this).setCursorPosition(4); }); What would the implementation o...
I have two functions to add and remove table rows that contain a form input element. They both work fine, but I have a problem in that I need to show a Remove button input only on subsequently created table rows. My two function are as as follows: function addRow(table_id){ var clone; var rows=document.getElementById(table_id).getElemen...
I have a drop down list with known values. What I'm trying to do is set the drop down list to a particular value that I know exists using jQuery. Using regular JavaScript, I would do something like: ddl = document.getElementById("ID of element goes here"); ddl.value = 2; // 2 being the value I want to set it to. However, I need to d...
Using YUICompressor I get the following error from my javascript code: [ERROR] 270:201:missing name after . operator [ERROR] 292:6:missing ; before statement Here's the javascript code at the following lines: Line 270: new _ow.getScript(_ow.wwwurl+'/widget/save?title='+encodeURIComponent(this.obj.title.value)+'&url='+encode...
I came across a javascript puzzle asking: Write a one-line piece of JavaScript code that concatenates all strings passed into a function: function concatenate(/*any number of strings*/) { var string = /*your one line here*/ return string; } @ meebo Seeing that the function arguments are represented as an index...
This is somewhat related to this question, but I'm not asking for resources about best practices in JavaScript, but your actual advise. I'll start with my own list. You may either post an answer or directly edit the question if you're sure the advise is not controversial. Here we go: always use var capitalize names of constructor fun...
I want to disable Javascript once a page has already loaded. Why? Because I want to test how the behavior of something like the following 'degrades' when javascript isn't available, but i dont want the hastle of going to the browser's top level javscript enable/disable feature. In addition I specifically want to disable it after the pa...
I've been using Javascript's Date for a project, but noticed today that my code that previously worked is no longer working correctly. Instead of producing Feb as expected, the code below produces March. My code looks something like this: current = new Date(); current.setMonth(current.getMonth()+1); //If today is Jan, expect it to be...
hi, I have an input box, and I have bound both blur and keypress events to the input. but the problem is when there is a keypress event blur event also fires. Is there any way to suppress blur event when keypress event occurs? thanks ...
I'm novice with both JS and jQuery, and I'm a little bit confused about what situations would require you to pass event as an argument into the function, and what situations you would not need to. For example: $(document).ready(function() { $('#foo').click(function() { // Do something }); }); versus ...
I've searched through google (maybe I didn't look hard enough) but I could not find how to turn Math.sqrt into an int. I want to use Math.sqrt for a for loop and I guess I need it as an int but I can't seem to figure out how to cast the result to an int. So how do I do it? I tried something similar to Java: (int) Math.sqrt(num); Bu...
Hi, I have done the following code in JavaScript to put focus on the particular element (branch1 is a element), document.location.href="#branch1"; But as I am also using jQuery in my web app, so I want to do the above code in jQuery. I have tried but don't know why its not working, $("#branch1").focus(); The above jquery (focus()...