javascript

Html javascript to open new window and close current window

I have a popup window and in the page i have one the follow code in the body. The purpose is to have this popup windows close when user click on the image link, and a new page will be opened and directed to "http://www.somesite.com". it works with IE and Chrome, however, in Firefox, the popup window is closed but no new windows is opene...

jQuery toggle running twice

It seems that this code: $(function(){ $('.show_hide_login').toggle( function (){ alert('show'); $("div#fullpage").show(); $("div#loginbox").show(); }, function (){ alert('hide'); $("div#loginbox").hide(); $("div#fullpage").hide(); } ); }...

Photoshop-esque blend mode in web pages using CSS or JavaScript?

Hi, I am wondering if it is possible to blend two or more images together on a webpage using blend modes like you will find in photoshop (overlay, screen, lighten, etc). I know that this kind of thing is possible with flash and java, but is it possible without any plugins i.e. with CSS or JavaScript? I have seen a few javascript exampl...

FF Extension - Not Keeping Global Variable Values

Hey there, I'm working on a FF extension that in short, loads dynamic images into a sidebar. The ID's that I get are from a JSON response, and are stored in a global variable declared in the same .js file as I intend to use it. My problem is when I try to simulate paging through my results. I load the sidebar using my global variable an...

Using myFuncArray.shift()() to call functions

I am having troubles using shift() to call functions I have put in an array. I have put together a simple example illustrating the problem. Essentially the function gets called, however, the changes to variables in the function do not stick. <html> <head> <script type="text/javascript"> Taco = function() {}; Taco.prototype.init = funct...

Possible to stop ASP.NET event using jQuery/javascript?

I have some code like below in an aspx page: ... function CheckEditing() { var answer = confirm('You are currently editing an item. If you continue to the next page your changes will not be saved. Would you like to continue?'); if(!answer) { return false; } ...

How to extend an Object with a new method, "plugin-style"?

Trying to "extend" myStuff object with a new method in a plugin-style fashion, but when I call the new plugin's method ($.validate.newthing()), I get a function does not exist error for it. How can I properly extend myStuff with the "validation" plugin below? <script type="text/javascript"> var myStuff = function(){ return...

How do I show next result in MySQL on "onclick" in JavaScript?

I want to show a certain amount of results (say, 5) and make a: <a href="" onclick="<?php ShowNextResult(); ?>"> And use onlick to show the next 5 results. ...

Charting in real time

What is the best solution for charts that refresh 5+ times a second? I'll even drop that to once every 1-5 seconds if I can get charts that don't "blink" when redrawing. I'm willing to use any technology, but considering the application already uses WebSockets you can recommend just about anything and it can be used. ...

Is there a way in javascript to get the scope of an object?

Are there any properties one can use or web tools so I could evaluate the scope of two javascript objects at runtime? ...

Maximum Regular Expression size in "modern" web browsers?

What's the maximum size of a regular expression in modern browsers (i.e. Firefox 3+, Safari 4+, IE 7+)? Assume a simple regular expression, of, say "foo|bar|baz|woot|..." ...

Change Element Id with Javascript, if...else if...else

I'm trying to create an if...else if...else argument where the only variable is the current Access Level number. This will determine what content to display to the user, so that someone with level 1 will see one thing while someone with level 0 will see another. By default everything is hidden, but once someone goes to the web page the ...

why does javascript have a set of built in objects?

any particular reason? ...

javascript function help to get the Element by ID from a Frame's src?

Default.aspx <html> <frameset id="MainFrameset" rows="78,*" border="0" framespacing="0" frameborder="0"> <frame application="yes" name="menuFrame" src="<% = GetMenuFrameSrcUrl() %>" scrolling="no" noresize> </frameset> </html> Default.aspx.cs public string GetMenuFrameSrcUrl() { return "http://localhost/Applicatio...

General Looping question

var answer = " "; var correct = "4"; var question = "What is 2 * 2?"; for(i = 2; i < 5; i++) { answer = prompt(question, "0"); if (answer == correct) { alert("Your answer is correct!"); break; } } How many chances would the user have before the break command got executed? ...

Trouble with executing code if checkbox is unchecked

I need to validate values of a form only if checkbox is unchecked. If it is checked, I will use values added previously. Now the thing is this or any of these code are not working. As I need to validate these values before I redirecting values to another form. var ui=document.getElementById('same_info').value; ui.OnChange = valid; ...

ComboBox "New Option" Option w/ Popup Input to add option

I'm learning so be nice. I'm developing a web app for a product management system. My office purchase wholesale from multiple vendors and direct. My web app needs to accommodated basic "new vendor" creation within a product insert/update form. Is there a simple way to have an option in my combo box "New Vendor" that opens an input bo...

Which is the best way to call a javascript function on a link ..

I want to add some links to some website of mine, but these links will call a javascript function and will not be underlined, also I want the cursor to be changed to a standard pointer. Which is the best way of doing it and why? Right now I can think of two aproaches: <a href="javascript:someFunction()" style="text-decoration:none">LI...

Does anyone know how to change the character of a textfield caret with javascript?

Like the title reads, I want to change the character of a caret. Maybe make it a letter or something? Thanks. ...

Sorting a list alphabetically with a modulus

I don't have any trouble grabbing a list of elements and sorting them alphabetically, but I'm having difficulty understanding how to do it with a modulus. ### UPDATE ### Here's the code working 'my way', however, I like the re-usability of the answer provided below more, so have accepted that answer. <script type="text/javascript"> $(...