Protected Static Members, Abstract Classes, Object Composition Vs. Subclassing
Nov 26, 2005
I've recently been following the object-oriented techiques discussed
here and have been testing them for use in a web application. There is
problem that I'd like to discuss with you experts.
I would like to produce Javascript classes that can be "subclassed"
with certain behaviors defined at subclass time. There are plenty of
ways to do this through prototyping and other techniques, but these
behaviors need to be static and protected. By protected this means
that they can be overridden (or reassigned) in subclasses, and
privileged subclass methods can access them, but callers external to
the class cannot.
I've been attempting to define a factory function that transfers its
parameters to an anonymous object while defining the constructor in a
-with- block. (This is what I'm loosely referring to as "subclassing"
- it's really object composition.) This works, but not for
externally-defined functions. They can't see the protected static
members....
I'm not sure why, but the Console.focus() and Console.writeln() methods just don't seem to be able to use the DOM references stored in Console.STDIN and Console.STDOUT. Everything's fine in the constructor, but other methods can't seem to use them.
Has anyone noticed this behavior before? This really threw me off... I would have expected prototyped arrays to be private to each class instance rather than shared between all class instances.
HTML Code: <html> <head> <script type="text/javascript">
I need a java bookmarklet that does a real simple thing. I need to take the current URL (ie, where the user is when they click the bookmarklet) and append it to a static URL and return the text on the resulting page.For example:
The user is at http:[url]....
The user clicks the bookmarklet.
the bookmarklet takes http:[url].... and appends it to http:[url]... HERE where you see the URL HERE text.That PHP script echos a simple line of text (a shortened URL actually).Then I want that result from the outside_create.php file to be displayed in a window back to the user.Is this even possible? Basically I need to know how to append location.href to a static URL and how to get the resulting content from the static URL..
I have static object and I want remake it to a constructor with property 'length' which would be not enumerable in for loop... This is my object and how I generate it
I want to make a script that composes an image depending on several variables. The image is composed of a base piece of clothing (e.g. t-shirt) on which an image and text can be placed. The color of the piece of clothing; the location of the image, the image itself and the text are variable. Also the font of the text can change. Is there a base script I can use? Or is there a small script that handles a piece of the desired functionality?
Probably this is a thing better done in flash. But I don't know flash and really don't want to either. Code:
function jsFileManager(mode) { this.mode = mode; }
If there a way to make jsFileManager.mode property as final protected. Other words, it can be set only once diring the objects initialization and it is accessible only to the inner methods of jsFileManager conctructor?
I want to make a page on a [URL] site (meaning no SS scripting) that is password protected. The problem is I have no idea how to make it to where someone can't see the password. The best I could think of would be:
if (password=="p455burrito") { window.open(/*blabla*/); }
But then someone could easily check the source code (even if I put the variable in another file or anything, it could still be seen). So someone redirected me to the Bravenet password protection, but I don't know how to make it redirect to a page that is protected by the password. If I put the password code on the page and log in, it redirects me where it's supposed to go, but I can still just go to the page myself and it's not protected.
How would I do this with just what [URL] allows?
I was checking out the more advanced Javascript tutorials and was thinking that cookies would be appropriate for this situation.
Also, I did search and I found things like this: [URL]
Which are easy to get through if you know how to look through the source code.
I am trying to hide my JavaScript source. The method I chose was to keep all the important source in a password protected folder, and then use a SRC="folder/script.js" to include it in my code. This way, the script will run, but the user will be unable to view the included code. Or so I think :).
I have tried this method, and it seems to work. However, I would like to know if you can see any problems with this. For instance, can you think of a way to bypass this and get at script.js? Can you foresee any problems that would arise as a result of keeping scripts behind password protected folders? Any other security concerns?
1. place name in heading tag provided2. locate script tag and create a cookie named password and assign to its value the user's entry into the pWord text box.3. test the file by opening the file and entering the password "hello" and see if you are able to enter the password protected page. test using the password "goodbye" and you should not be able to enter the page.Someone please help asap, I am including an attachment with a zip file with the page I am working on and the follow up page.
I've just started my venture into HTML5 localStorage. I now have a javascript my server sends to those who visit my ip address. I store all their data using localStorage. I have a few security questions regarding the HTML5 localStorage situation:
1. Can a script that did not create the local storage retrieve/modify the localStorage of another script just by guessing the key maliciously or unintentionally?
2. Can another script use the clear() method to remove my scripts data? Edit: I just tried this myself. And, yes, I deleted my data, all of it with clear() using a different script. Is there any way to prevent this? Is it only my end that will be able to do it or could I load a script from a site has a hidden clear() method and destory all other javascript apps data?
3. If item (2) is true, any ideas on how to protect my scripts data for the user from the clear method?
4. if item (2) is false, cool, my first idea is to create a uniqnue string random string and ask the user to creat a password to encrpt that string and just use that string with enumeration added to it for the keys.
5. Does anyone know where localData is stored? Is it encrypted already, in plain text, in well-known or hidden location?
I want to be able to automatically filter certain characters a user is typing in either an input field or a textara and automatically convert them to it's equivalent html entity. I've looked at .keypress, which will give me the character they typed, but I have no idea where in the box they have typed it.
I have a form that is done in php I'm converting it to .NET but the java script has an error. I posted all the code but the error is in the "saveOtherSurvivorValues" function i think. What happens is when you click the "add survivor" link to add a the first survivor and then fill out the information for the first survivor then click add survivor a second time for a second survivor it moves the data from the 1st survivor into different fields to produce in accurate data.
Here is a link to the live form.
[URL]
using System; using System.Collections; using System.Configuration; using System.Data;
I have a form that is done in php I'm converting it to .NET but the java script has an error. I posted all the code but the error is in the "saveOtherSurvivorValues" function i think. What happens is when you click the "add survivor" link to add a the first survivor and then fill out the information for the first survivor then click add survivor a second time for a second survivor it moves the data from the 1st survivor into different fields to produce in accurate data.
using System; using System.Collections; using System.Configuration;
I am developing a messaging service between members of my site. I am developing this with asp.net mvc. When a user goes to the SendMessage view to send a message to another member, there is a dropdown list which presents the sender with all the members of the site, which he or she will pick as the recipient. However, i don't want it to be a dropdown, i want it to be a text box, where a user types in the first couple of letters of a name, and the dropdown appears then with only the members which have the same couple of letters. This is basically like every email system out there (facebook and gmail have it just like that). And after they chose one, they can select another one in the same textbox, just separated by a comma or something like that. Basically, how do i achieve that in javascript? I'm not even sure what that functionality is called, that's why i had to explain it properly.
I'm trying to write an application to demonstrate to a friend how to highlight text in javascript, only problem is he wants it to be on divs only.
So say for example you have a page, and you select some text in the div (this is static text, not a form or anything) and you click "highlight" is there a way to wrap style tags around that highlighted text using javascript, without refreshing the page?
I have a javascript file that contains methods and the structure to form a popout menu. Then I have another javascript file that uses those methods/structure etc. to build a specific menu with all it's links, titles, etc. To have the menu created on my html page I link to the two .js files and put window.onLoad = writeMenus();
in between script tags that creates the menu right when the user gets to the page. My problem is, since the menu is created when the window loads, it's static. So when I resize my window, the menu won't resize. In my .js files I have the positions of the menu based on screen.width/# so they aren't set values. I think my problem is with using the .onload. It loads the menu once at the beginning but doesn't know to redo it when the window resizes.
as an example,when you enter in a username, a static string of "Your [URL]has the USERNAME replaced with what you are typing in.This is day one of JQ for me. I was looking at the onkeyup event in JS in general, but I figure it is time for me to learn JQ.I am pretty sure I am going to
<script type="text/javascript"> $(document).ready(function(){ // something fancy here
I'm trying to learn JavaScript on my own and am using a Dashcode example (if anybody uses Dashcode, the example is the "Browser" web application template that is shown when Dashcode opens).
Briefly, the JavaScript generates a list of "Locations" in the USA:
Code JavaScript: // Sample data. Some applications may have static data like this, but most will want to use information fetched remotely via XMLHttpRequest. var parks = [
[Code]....
I want to retain the layout and structure but, depending on the "Location" have different text for each of the new pages (not "the scenery is amazing etc).