I was trying to make some clever class based on a factory pattern. See this page: [URL] So i did this:
[Code]....
As you can see, I have an internal method "showDialog". In the jQuery part, where i create a dialog, I have two function for the drag and dragStop events. Why can I not create them in the same way as the showDialog function? Something like this
I've previously written an image carousel with lightbox and to be honest forgot about it for quite a long time. I've just been tasked with making a few modifications (I wrote this code about 6 months ago)
Now, the problem I have is that I now need to call the internal method from the ligthbox plugin.
I've tried setting a reference to this like this but it just won't play ball. I can see that the ajax feed gets called but unfortunately I can't then access it.
Firstoff: I know I ask about using a plugin, and I wasn't so sure where to put my question in, decided though the general jQuery-Forum would be better as my problem is more connected to jQuery than the plugin itself. First off, I'm using this plugin and modified it myself a bit, adding new functions: [URL] You'll find the underlying .js for the component here: [URL] Now, scroll to the end of the file, you'll find some "internal functions" like _registerRemoveEvents
i am having trouble with a program for class hoping someone can point me in the right direction i am supposed to use nested for loops to output 2 seperate webpages one with the first pattern below and then another with the second pattern.
How would I go about copying all the prototype functions AND the constructor from one object into another object, and then call them?
I know I can use this.example.call(this), but that's not an acceptable solution. I want to deploy this style over dozens, potentially hundreds of objects.
how to use Javascripts and using Prototype framework by following a step by step tutorial from a book. Unfortunately when I stepping through the following code:
Code: <html> <head> <title>
[Code]....
The prototype file can be acquired at Prototype website download
According to ECMAScript, the root of the prototype chain is Object.Prototype. Each object has an internal property [[Prototype]] that could be another object or NULL.... However, it also says that every function has the Function prototype object: Function.Prototype, it confused me, because a function is an object, for a function object, what is its function prototype and object prototype..For example:
var x = function (n) {return n+1;};
what is the relationships of x, Object.Prototype and Function.Prototype
I am trying to get to the bottom of javascript object, prototypes etc. I have a fairly good grasp of it, but I get confused the closer I get to the base object.prototype. FIrst of all, I was under the impression that all objects descend directly from Object. But some objects (like Array) seem to inherit properties and methods from the function.prototype. So does this mean that the chain is like this:
object -- function -- array Second, I noticed (on the mozilla javascript reference site that object.prototype inherits properties and methods from function.prototype and vice versa!? How can this be? I must be missing something important about understanding the chain?
I ask the user to enter a time in the formatio 12:30 PM. onChange I send the string to this function. I'm using alert boxes to test it...and am always getting the "Does not work" alert box. What am I doing wrong?
I am new to javascript and would like to search for the element with id but the element id are changing if i use different navigation in that web page example: C21_W68_V69_notes_struct.text changes to C24_W78_V79_ notes_struct.text or any other name next time hence i would like to search that element using a pattern like notes_struct.text as there exist only one element ending with this pattern. I am using old version IE and would like to use javascript only.
I have written an ASP.net app that pulls settings from a database. Part of the setting definition is a regular expression that I want to use on the client via JavaScript for data validation...
1) Sample code for the setting object: ---------------------------------------------------- function setting(id, name, validationPattern, validationMsg) { this.id = id; this.name = name; this.validationPattern = validationPattern; this.validationMsg = validationMsg; }
2) Sample code on the page that creates a new setting object: ---------------------------------------------------- setting(1, 'test', '^d{1,1}$|^d{2,2}$|^100$', 'invalid value');
3) The issue: ---------------------------------------------------- The setting object gets built just fine except the pattern argument gets escaped by javascript!!!
^d{1,1}$|^d{2,2}$|^100$
GETS ESCAPED TO
^d{1,1}$|^d{2,2}$|^100$ (Notice how the double is now a single )
Is there any way for me to preserve the pattern text as is?
I want to validate the value in a textbox such that the first character should be a symbol like # or $ followed by 2 alphabets which is followed by numbers.I tried a pattern like code...
Im trying to find if a particular html markup pattern (<ROD> ... </ROD>) within a string and if its found then replace it with another string.eg."This is my string and it might <ROD>PartNumber123</ROD> contain HTML markup"So in this case I want to replace "<ROD>PartNumber123</ROD>" with {0}. If there is no <ROD>...</ROD> then dont do anything.Im sure im doing this the wrong way, maybe a regular expression would be best.Although this works its not very clean and I just cant find the correct solution.
function parseData(data){ var r1 = data.indexOf("<ROD>",0); var r2 = data.indexOf("</ROD>",0);
I am trying to do a pattern match and check something in a condition but cant get it to work. The first value changes and I need to check and do something if I get a hit on it.
Code: var mydata = "?first=one&second=two&third=three"; if (mydata.indexOf("first") == "something") { alert("No Hit"); } else { alert("Hit"); }
Basically I am trying to find out if first is equal to one in the mydata string. My above attempt is not working.
I need to validate three textboxes and it will validate for numbers. How should I change my code to validate three textboxes?
Code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
[code]....
I need to use Javascript to validate 3 textboxes, whereby the users can only key in numbers (because they are phone numbers related fields). If any of the textbox is empty, display an alert message to show which textbox is empty. I do not want to show many alert messages to show that, for example, text1 and text2 are empty, it will show two alert messages. I would need to show one "summarized" alert message instead.Next, check if the textbox matches the pattern (which is to check if it has the skeleton of a phone number). If it is, show an alert message that it is alright. Else, show that it does not match.
I need to supply a method with an array of strings, which will eventually be used to pattern match against another array of strings.
1. Is there a good way to span multiple lines when creating an array from a list of strings? (I want the most readable list I can get.)
// The following doesn't seem to work urlExclusions = newArray( "my.domain.com/dir1", "another.domain.com/dir2", "third.domain.com/blah" );
2. When I'm looping over the above array in a method, what's the best way to use these as patterns to match? Does "new RegExp(urlExclusions[i], "i") do all the necessary escaping of whatever literals might be in the urlExclusions[i] string? (All characters in the above strings should be treated as a literals. I don't intend for that list to be a place to put RegEx.)
Example: I want to do something like this with the list:
for (var i=0; i < urlExclusions.length; i++) { pattern = new RegExp(urlExclusions[i], 'i'); if (pattern.test('http://my.domain.com/dir1')) { document.write("Matched"); } else { document.write("Didn't Match); } }
I am trying to make an application that displays a pattern of asterisks a certain way. the only output statements I could use are to get the pattern below. My question would be which way to use the nested loop, (do i do while(if else)...
This code not sure what the final result should be. <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" [URL]"> <!-- Exercise 7.25 Solution --> <html xmlns = "[URL]"> <head> <title>Solution 7.25</title> <script type = "text/javascript"> <!-- var side = 8; var row; document.writeln( "<pre>"); while(side>=1){ row = 8 if (side % 2 != 0) document.write(" ") while(row >= 1){ document.write("* ") row -= 1; } end while document.writeln(); side -= 1; } end while document.writeln("</pre>") --> </script></head><body> <p>Click Refresh (or Reload) to run this script again.</p> </body></html>
This what I got when I ran the script. Click Refresh (or Reload) to run this script again. These ere the constraints of the assignment. Write a script that outputs XHTML text that displays the checkerboard pattern: Your program may use only three output statements to display the pattern: 1. Only one document. write( "* " ); 2. Only one document. write( " " ); 3. and Only one document. writeln(); writes a newline character You may use XHTML tags (e. g., < pre>) for alignment purposes. [Hint: Repetition structures are required in this exercise.]
It checks that the character before the comment isn't a backslash or that we're at the start of a string/line since it's in multi-line mode. Then it captures the actual comment. Seems to work so far... I have the following RegEx that matches double slash comments:
Code JavaScript: ///.*$/gm
It works fine except for this one exceptional case where a RegEx which ends in a slash is followed by a comment as in the following example:
Code JavaScript: //*[sS]*?*//gm, // Slash comment
The RegEx captures "//gm // Slash Comment" as a comment, removes that piece, and in the process breaks what used to be a valid RegEx statement. how I might be able to fix the pattern to avoid this issue?
I wanted to only match in the middle of a string I have a string = " sdfasf 23234" I wanted to get the numbers like /([0-9]*)/ But this fails and returns nothing because the string begins with letters. Instead I had to do /[a-zA-Z ]*([0-9]*)/
If that's the case then, why do we bother with something like /^[a-zA-Z]*([0-9]*)$/ The pattern is already assumed to start at the beginning of the string