Forum: JavaScript / DHTML / AJAX Oct 17th, 2008 |
| Replies: 2 Views: 590 Why would you expect the return value from Math.random( ), to have the same value when the function is called twice? That's kind of the point of Math.random( )...
Store the result of the first... |
Forum: JavaScript / DHTML / AJAX Oct 9th, 2008 |
| Replies: 25 Views: 7,527 How are you using the result of the regex match? Perhaps you're using the result incorrectly, because that seems backwards.
Check regexes on the tester application here:... |
Forum: JavaScript / DHTML / AJAX Oct 9th, 2008 |
| Replies: 25 Views: 7,527 no, ^ as the FIRST character INSIDE the square brackets means that the whole set is negated, i.e. the set of characters is a set to NOT match.. eg:
[^x] means not x
and ^ as a character other... |
Forum: JavaScript / DHTML / AJAX Oct 9th, 2008 |
| Replies: 25 Views: 7,527 alpha = [A-Za-z]
numeric = [0-9]
special characters = could be [^A-Za-z0-9], but it depends on your definition of 'special'. usually it's prefered to treat _ ( underscore ) as non-special at... |
Forum: JavaScript / DHTML / AJAX Sep 11th, 2008 |
| Replies: 4 Views: 778 To me, Javascript/HTML/CSS animation always feels like an ugly hack: sure there are libraries available to assist with the lack of any built-in support for graphics*; but then there are libraries to... |
Forum: JavaScript / DHTML / AJAX Aug 29th, 2008 |
| Replies: 9 Views: 3,003 I absolutely agree, unless the task at hand is simple enough to be considered a "primitive operation" in itself, and personally, I consider looping over a string's characters to be something thats --... |
Forum: JavaScript / DHTML / AJAX Aug 29th, 2008 |
| Replies: 9 Views: 3,003 Regardless of whether you're doing this for input sanitising or not, the method I suggested has the best complexity guarantee.. it's always O( n ). Worst case, assuming a string of all special... |
Forum: JavaScript / DHTML / AJAX Aug 29th, 2008 |
| Replies: 3 Views: 905 There's at least two ways, one is to put all the code that is supposed to be executed after the response has been obtained into the end of the onreadystatechange handler function; the second way (... |
Forum: JavaScript / DHTML / AJAX Aug 29th, 2008 |
| Replies: 9 Views: 3,003 If you're doing this for the purpose of input sanitizing, there are probably less 'safe' characters than there are 'unsafe' characters, create a new empty string ( string 2 ) loop over the input... |
Forum: JavaScript / DHTML / AJAX Aug 28th, 2008 |
| Replies: 3 Views: 905 Ajax stands for asynchronous javascript and xml. Note that you set the onreadystatechange handler to that anonymous function, but you dont have any guarantee that that function will be executed... |
Forum: JavaScript / DHTML / AJAX Aug 15th, 2008 |
| Replies: 2 Views: 631 There are no specific server-side requirements for ajax in itself, but people do often write/use ( custom ) programs that run on their server, and communicate back and forth with certain ajax-enabled... |
Forum: JavaScript / DHTML / AJAX Aug 15th, 2008 |
| Replies: 6 Views: 1,011 Google don't take kindly to people running automated queries ( including scrapes ) without using their "official APIs", so you may find they block your server from communicating with the Google site... |
Forum: JavaScript / DHTML / AJAX Aug 2nd, 2008 |
| Replies: 2 Views: 957 You can't disable the close button in a popup. It's part of the browser; a webpage rightfully can't assume control over all aspects of the browser.
Reorganize your logic so that it isn't an issue,... |
Forum: JavaScript / DHTML / AJAX Aug 1st, 2008 |
| Replies: 16 Views: 11,886 That's something I never considered.
I don't consider coercion in and of itself a bad thing ( coercion between numeric types is a must ).. but.. implicitly having numbers converted to strings and... |
Forum: JavaScript / DHTML / AJAX Aug 1st, 2008 |
| Replies: 16 Views: 11,886 Ouch. I'd rather prefer to know if something is or isn't an object a string, a boolean, a null, etc. Hence typeof. Only testing ( x !== undefined ) and/or ( x !== null ) isn't atall helpful if I... |
Forum: JavaScript / DHTML / AJAX Aug 1st, 2008 |
| Replies: 16 Views: 11,886 Of course, there are sometimes occasions where the distinction is meaningful, but === undefined or === null aren't always the most useful, consider:
if( x !== undefined ) {
x.something( );
... |
Forum: JavaScript / DHTML / AJAX Aug 1st, 2008 |
| Replies: 16 Views: 11,886 Well, yeah. ( undefined == null ) only works via type coercion.
IMO, more useful ( and pleasant reading ) than either is to coerce straight to boolean;
if( x ) {
// where x may be null,... |
Forum: JavaScript / DHTML / AJAX Jul 31st, 2008 |
| Replies: 16 Views: 11,886 All that code proves is that null is not equal to the empty string. The value of the 'email' field will not be initialized to null, it'll be initialized to "".
However -- and it would be quite... |
Forum: JavaScript / DHTML / AJAX Jul 1st, 2008 |
| Replies: 4 Views: 1,861 It's not safe to assume that HTTP is used exclusively; a server that publishes this information in a webpage could actually use any underlying protocol to collect the information. Just because HTTP... |
Forum: JavaScript / DHTML / AJAX Jun 27th, 2008 |
| Replies: 24 Views: 45,897 In my comment about the document being on a server; I'm pointing at the sillyness you also note in the W3C's wording: that of an implied concept of a browser 'removing' a document from some kind of... |
Forum: JavaScript / DHTML / AJAX Jun 26th, 2008 |
| Replies: 24 Views: 45,897 Really not nonsense, There's nothing in standard HTML + JS that mandates the existance of a _window_ let alone an event when it closes. Each browser handles its idea of a 'window' in a different way.... |
Forum: JavaScript / DHTML / AJAX Apr 26th, 2008 |
| Replies: 24 Views: 8,208 Well.. alot of the questions you've asked in this thread have quite complex answers, but those answers are very easy to find/work out yourself.
Can you serve two pages to two different browsers?... |
Forum: JavaScript / DHTML / AJAX Apr 16th, 2008 |
| Replies: 11 Views: 4,128 You can't stop the right click action in a plain XML file. On some browsers, you can prevent the right click action in an HTML file, because an HTML file is allowed to run javascript, which is... |
Forum: JavaScript / DHTML / AJAX Apr 15th, 2008 |
| Replies: 24 Views: 8,208 The first meta tag in that page is in the wrong place... move it to be inside the head section. Try validating the code aswel, correct any errors and see if it still has a problem. |
Forum: JavaScript / DHTML / AJAX Apr 14th, 2008 |
| Replies: 6 Views: 1,107 Yeah, it's just faking it. The little yellow alert region is simply a CSS styled div element. It works on all browsers, and looks quite out-of-place in Opera :D. |
Forum: JavaScript / DHTML / AJAX Apr 10th, 2008 |
| Replies: 6 Views: 3,162 If the mouse is locked, how do you click again to unlock it?
What do you mean exactly by 'locked'? I took that to mean disabled/no longer functional. |
Forum: JavaScript / DHTML / AJAX Apr 9th, 2008 |
| Replies: 6 Views: 3,162 No. No sane browser / OS setup will let a webpage 'lock the keyboard or mouse'. Think for 30 seconds why this is the case.
If you want to disable all interaction with your site when the user... |
Forum: JavaScript / DHTML / AJAX Mar 2nd, 2008 |
| Replies: 4 Views: 3,060 Initially, the click handlers for all objects are assigned to the size change function. When you click an object for the first time, the size is changed, and the click handler for that object is... |
Forum: JavaScript / DHTML / AJAX Feb 29th, 2008 |
| Replies: 4 Views: 3,060 Right.. not entirely sure what you're after; I can't work out which you want:
1: The first 'click' to perform 'sizeChange' and the next click to perform 'sizeRestore' ( and then to repeat for... |
Forum: JavaScript / DHTML / AJAX Feb 27th, 2008 |
| Replies: 11 Views: 4,684 Alternatively, try this trick, if you don't mind presetting the available colors ( in a way, it's better because those colours can be defined in the CSS ). This works by dynamically changing the... |
Forum: JavaScript / DHTML / AJAX Feb 26th, 2008 |
| Replies: 6 Views: 3,092 This thread has been merged and re-named. The original merge sources were 'can anyone help' and 'To the second listbox'. Replies are now in chronological order as posted in both original threads. |
Forum: JavaScript / DHTML / AJAX Feb 24th, 2008 |
| Replies: 6 Views: 6,511 Err... you could remember where the song is and restart it at the correct place on every page; but getting it syncronized properly over the Internet will be hell. It would take a long time to... |
Forum: JavaScript / DHTML / AJAX Feb 17th, 2008 |
| Replies: 12 Views: 1,321 Wel... you probably shouldn't quote the generic families ( serif, sans-serif, cursive, monospace, etc ).. but arial is a system dependant font; ( its a microsoft font ), so, if you want... |
Forum: JavaScript / DHTML / AJAX Feb 17th, 2008 |
| Replies: 12 Views: 1,321 Slideout1 isn't defined because the browser checks you're using arent working properly: you're either not selecting a browser atall ( likely, since you don't have any kind of 'default' case ) thus... |
Forum: JavaScript / DHTML / AJAX Feb 17th, 2008 |
| Replies: 12 Views: 1,321 Font-family names can be quoted. Especially, because the the name might contain whitespace, like 'Nimbus Sans L Condensed'. There is no harm in quoting font family names, even if they do not contain... |
Forum: JavaScript / DHTML / AJAX Feb 12th, 2008 |
| Replies: 2 Views: 7,140 No, you can't do this in any cross-platform way. There's many good reasons why not - for one, a site could launch popups that were difficult to close without using hotkeys or a task manager. The fact... |
Forum: JavaScript / DHTML / AJAX Feb 8th, 2008 |
| Replies: 17 Views: 13,004 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>... |
Forum: JavaScript / DHTML / AJAX Feb 7th, 2008 |
| Replies: 17 Views: 13,004 This works for me on Opera 9 and Firefox 2. Can't check on IE7 cause I don't have it. Not sure if it's exactly what you're after - noteably, you'll have problems making the top 'div' fill a proper... |
Forum: JavaScript / DHTML / AJAX Feb 7th, 2008 |
| Replies: 17 Views: 13,004 That 'works' because putting anything on the first line of an XML file other than a DOCTYPE renders the DOCTYPE totally ineffective - it will at best be ignored, and doing something like this should... |
Forum: JavaScript / DHTML / AJAX Jan 26th, 2008 |
| Replies: 3 Views: 2,025 Using the Javascript XmlHttpRequest object ( all common modern browsers have it, although it sometimes has a different name ), you can issue a HTTP request to any page or program on your server, and... |