|
Master_Odin posted:What weird functionality as it appears to work perfectly after I refreshed the page a couple times, even though at first it did allow the "Getting Started" page to go through while nothing else. I think what's interesting is that reload() works, but assigning the location did not.
|
# ? Apr 5, 2011 20:14 |
|
|
# ? May 16, 2024 20:45 |
|
I had an idea for an app to make my work life a little easier and to work on some HTML 5 skills. The app would be for creating and maintaining a list of records and having some default (but configurable) settings seeded for new records to use. Because of the deployment scenarios I'm really hoping to keep this pure HTML 5 and JavaScript. Deployment will require that the data stored by the app be transferable along with a copy of the app. Example: If someone copies the entire folder the app runs out of to a thumb drive then the a copy of the data should go right along with it. This means HTML 5 local storage is immediately disqualified as an option. My next thoughts were XML and JSON. Googling has turned up a few techniques and libraries for either reading or writing XML using JavaScript. I'd prefer to keep my dependencies down to one library if possible. I haven't been able to find much on reading/writing JSON to files. Does anyone have any preferred or recommended libraries for either of these formats? I'm curious to find out how others have approached similar scenarios and what lessons and pitfalls reside along the way.
|
# ? Apr 6, 2011 23:27 |
|
Sounds like Sproutcore but Sproutcore -is kind of difficult to learn -is going through some flux at the moment -can't write back to local files You're always going to have problems with the last. Javascript can't read/write files from the browser for a good loving reason. You can serialize read only data with Sproutcore though if that's all you need. In fact the getting started introduction uses a static object. But, Sproutcore is kind of difficult to learn, especially if you don't have any experience with OSX or iPhone type development. It follows the same development patterns since it was largely an Apple project.
|
# ? Apr 6, 2011 23:35 |
|
After thinking about it more I suppose the best approach is to just display/receive a pop up with a data dump if a user needs to transfer records.
|
# ? Apr 7, 2011 00:59 |
|
You can use something like store.js as a wrapper around localStorage and cookies.
|
# ? Apr 7, 2011 04:03 |
|
I'm following along in a textbook and it told me to run a function like this:code:
This works just fine in Chrome, but not in Firefox 4. Is this normal?
|
# ? Apr 9, 2011 23:55 |
|
Vat of Lead posted:I'm following along in a textbook and it told me to run a function like this: Yes. code:
|
# ? Apr 10, 2011 00:15 |
|
I'm interested in learning javascript from some ASP.NET stuff I want to do. Does anyone have a recommended introduction site or something along those lines?
|
# ? Apr 11, 2011 02:13 |
|
Adahn the nameless posted:I'm interested in learning javascript from some ASP.NET stuff I want to do. Does anyone have a recommended introduction site or something along those lines? http://javascript.crockford.com/ Buy his book "java script: The Good Parts" as well. The mozilla docs are a good reference as well: https://developer.mozilla.org/en/JavaScript/Reference
|
# ? Apr 11, 2011 03:37 |
|
Adahn the nameless posted:I'm interested in learning javascript from some ASP.NET stuff I want to do. Does anyone have a recommended introduction site or something along those lines? http://eloquentjavascript.net/ Also seconding the recommendation for Crockford's book, just go into it knowing that he is VERY opinionated & you don't have to agree with everything he says.
|
# ? Apr 11, 2011 05:19 |
|
How would I submit a form inside an iframe? The form is set-up correctly that outside the iframe, it submits fine and what have you. However, when trying to do:code:
The ids are right with the first being the frame and the second being the form.
|
# ? Apr 13, 2011 02:53 |
|
Master_Odin posted:How would I submit a form inside an iframe? The form is set-up correctly that outside the iframe, it submits fine and what have you. However, when trying to do: Try something like this with jQuery: code:
http://forum.jquery.com/topic/jquery-how-to-access-iframe-window
|
# ? Apr 13, 2011 04:28 |
|
It's a CSRF lab so I don't think the policy is overly important? Basically, I'm just trying to come up with a way to make it so that when I submit a form to the "vulnerable" website, I'm supposed to be able to edit their profile/make a new post/etc. However, when submitting a POST form with the .submit() command, I get sent to the site which would be no good for trying to silently mess with people. Tried to use an iFrame to just load the form in it and send it through that but it still doesn't seem to work (not getting an error anymore on the script though so thanks for that). It's annoying as basically our professor gave us this lab document obviously gotten from elsewhere and we're expected to teach ourselves javascript and html to perform these things and ugh. My code is: code:
|
# ? Apr 13, 2011 04:54 |
|
I have a complete idiot question. I am not a web developer, and I do not have much control over the product I'm using. I work at a nonprofit doing database things, and me and my small team are the only computer-literate people here so this problem was dumped on us to solve and we have about 2 hours. I have a page. It is the second step of a two-step process for signing up for our email list. Step one: fill out a form. Step two, a confirmation page is displayed that has a <form> tag, inside of which is a <table> that displays everything you entered in step 1. After the table ends, there are a bunch of <inputs> that are hidden that store the actual data that you entered in step 1. I would like to hide a couple of the rows in this table using javascript, but can't seem to make it work. The gist of what I want to do is: code:
edit: here's the source for the page showing that I am, I believe, getting the right element code:
Sub Par fucked around with this message at 21:51 on Apr 14, 2011 |
# ? Apr 14, 2011 21:47 |
|
If that's all you want to do, just set the innerHtml property to an empty string (or a space if the empty fucks up somehow): document.getElementById('inputfieldcellPHONE').innerHtml = ' ';
|
# ? Apr 14, 2011 22:23 |
|
Munkeymon posted:If that's all you want to do, just set the innerHtml property to an empty string (or a space if the empty fucks up somehow): document.getElementById('inputfieldcellPHONE').innerHtml = ' '; I tried that. I can't get it to manipulate the DOM for these parts of the page at all. When I try code:
|
# ? Apr 14, 2011 22:30 |
|
Are you sure you're doing this when the DOM is loaded? If you just stick it in a bare script node in the header, it will run before the browser is ready to manipulate the HTML.
|
# ? Apr 14, 2011 22:42 |
|
Munkeymon posted:Are you sure you're doing this when the DOM is loaded? If you just stick it in a bare script node in the header, it will run before the browser is ready to manipulate the HTML. Good call. I can't really control much about where it goes, but it does remind me that when I tried running just alert("Blah");, I got the alert while the table itself hadn't yet loaded. Thanks. I'll try something else.
|
# ? Apr 14, 2011 22:45 |
|
http://www.webreference.com/programming/javascript/onloads/ might help with the onload thing
|
# ? Apr 14, 2011 22:51 |
|
It's innerHTML, not innerHtml. Just about everything is case-sensitive here. Also, this statement code:
EDIT: but when you start thinking about onload handlers and poo poo, I'd say gently caress it and use jQuery.
|
# ? Apr 15, 2011 16:49 |
|
Thanks for the recommendations for Crockford's book and the Mozilla references. Any recommendations for jquery in particular? Besides skimming the docs and fooling around with the API, of course. edit: Hah, didn't even see the jquery thread. I'll look there.
|
# ? Apr 16, 2011 04:50 |
|
So i'm trying to create an edit user form that uses jQuery. First there is a list of users, with an Edit link to the side. If you click edit, the link and the selected name is replaced with an input box to change the user's name, and a submit button. My problem seems to be that since the form for the input box isn't rendered when the page is first created, my javascript that i've c&p'd below isn't getting hooked (at least I think that is the problem). code:
|
# ? Apr 18, 2011 02:29 |
|
uG posted:So i'm trying to create an edit user form that uses jQuery. First there is a list of users, with an Edit link to the side. If you click edit, the link and the selected name is replaced with an input box to change the user's name, and a submit button. There are many things wrong with this code, but the #1 is that it will NEVER RUN. Let's remove the complicated stuff inside your outer function and put in something simple as a test: code:
code:
Lumpy fucked around with this message at 04:02 on Apr 18, 2011 |
# ? Apr 18, 2011 03:57 |
|
Lumpy posted:There are many things wrong with this code, but the #1 is that it will NEVER RUN. I'm assuming that is the problem, as the code you posted doesn't seem to be catching the submit either. It's my first day with javascript, so forgive me if I am missing something you already said.
|
# ? Apr 18, 2011 04:59 |
|
uG posted:I'm getting the html for the form from an ajax request, so it doesn't exist until after $(document).ready. How is the javascript that loads with the original page supposed to know when my new form suddenly appears? Do I need to tie into the javascript that makes the ajax get call that gets the form html? code:
|
# ? Apr 18, 2011 07:16 |
|
Ok I cleaned up the code like you said Lumpy. I have:code:
uG fucked around with this message at 02:19 on Apr 20, 2011 |
# ? Apr 20, 2011 01:34 |
|
uG posted:Ok I cleaned up the code like you said Lumpy. I have: You still have all sorts of extra crap all over the place. What is that leading semi-colon? Why do you wrap it all in a self-calling function? code:
Lumpy fucked around with this message at 03:56 on Apr 20, 2011 |
# ? Apr 20, 2011 03:50 |
|
Lumpy posted:You still have all sorts of extra crap all over the place.
|
# ? Apr 20, 2011 04:42 |
|
Hey I needs some help. I've been using this greasemonkey userscript for years:code:
https://bugzilla.mozilla.org/show_bug.cgi?id=622400 https://bugzilla.mozilla.org/show_bug.cgi?id=475008 I end up with weird file names like this: All I want is a filename that looks like this 'diFhdXo.pls' (without the 'pls-1.part' bit) I was hoping someone knew how to modify the js so it creates filenames without the offending characters in them. KingEup fucked around with this message at 07:37 on Apr 22, 2011 |
# ? Apr 22, 2011 07:29 |
|
I have a bit of Javascript on my website that grabs a random image and uses it for a banner:code:
I should say that I am not a Javascript programmer and that this is someone elses code example that I used and have outgrown.
|
# ? Apr 25, 2011 05:13 |
|
ZippySLC posted:the header directory The what?
|
# ? Apr 25, 2011 05:31 |
|
ZippySLC posted:I have a bit of Javascript on my website that grabs a random image and uses it for a banner: Javascript can't access the filesystem (as best I know). You could have some sort of PHP/etc script that provides a list of files, grab that through AJAX and then select an image from that list.
|
# ? Apr 25, 2011 08:46 |
|
If all the files are named sequentially anyways, can't you just do a random and then append that to the filename? Not sure why you'd need to make the array in the first place.
|
# ? Apr 25, 2011 21:05 |
|
epswing posted:The what? The directory where all of the header images are located. subx posted:If all the files are named sequentially anyways, can't you just do a random and then append that to the filename? Not sure why you'd need to make the array in the first place. Can you give me a bit of example code?
|
# ? Apr 26, 2011 04:33 |
|
ZippySLC posted:I have a bit of Javascript on my website that grabs a random image and uses it for a banner: You realize that javascript has a built in Math.random, right? No need to roll your own. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/random Also if you want to write an array literal, instead of code:
code:
ZippySLC posted:Can you give me a bit of example code? where XXX is a number from 001 to some maxFilenumber: code:
|
# ? Apr 26, 2011 05:47 |
|
Bah, I have avoided learning JS for years now, and I have decided to not put it off any longer! I'm having trouble with my very first test here. This is what I've got: code:
If I hard code the second line in the function to read: code:
How the hell do I do this? edit: Oooh, getElementById is much better. Winkle-Daddy fucked around with this message at 22:42 on May 11, 2011 |
# ? May 11, 2011 22:28 |
|
Winkle-Daddy posted:
code:
|
# ? May 11, 2011 22:50 |
|
FeloniousDrunk posted:
Thanks! That's what I was looking for but wasn't sure how to phrase it in a google friendly way.
|
# ? May 11, 2011 22:55 |
|
This is confusing me. console.log(oVar[i]) = [ "XXNULLXX" ]. console.log(oVar[i] === 'XXNULLXX') = false. console.log(oVar[i] == 'XXNULLXX') = true. I don't think I've ever seen a situation where a == on a string vs. string can return true but === returns false. Can someone please explain this? Edit: It appears that for some reason it's being double-object wrapped: oVar is [ [ "XXNULLXX" ] ]. So really, I'm saying "object == 'XXNULLXX'", and I'm sure through some weird casting that's coming out to true. Golbez fucked around with this message at 16:42 on Jun 7, 2011 |
# ? Jun 7, 2011 16:40 |
|
|
# ? May 16, 2024 20:45 |
|
Golbez posted:This is confusing me. if it's really [["XXNULLXX"]] then it's an array being compared to a string... and the array has it's .toString called to try to cast it so it can compare when you do the double equals check. Since there's only one element in the array, that returns the single element as a string matching what you are looking for, and it returns true. Fun example: code:
Lumpy fucked around with this message at 01:40 on Jun 8, 2011 |
# ? Jun 8, 2011 01:36 |