javascript

ASP.Net - How can I allow imported script files be viewed by unauthenticated users when using Forms Authentication?

I'm using ASP.Net and forms authentication. When a user is directed to the Login Page I get a JavaScript error: Message: Syntax error Line: 3 Char: 1 Code: 0 URI: http://localhost:49791/login.aspx?ReturnUrl=%2fWebImageButton.js This is because I am using a Custom Image Button in a separate Web Control Project control that adds ...

GUnload() a single Google Map

I've got some Javascript/HTML code which displays a variable number of maps dependent on what the user selects. I've worked how to dynamically create multiple maps on a page - that's well documented. However, what I'm not so sure on is... how can I safely destroy a map after it's been created - normally I just leave this to GUnload() t...

Templates or similar for JavaScript programs in the browser

I've done a lot of server-side HTML programming and used a number of different template languages for producing (X)HTML. This part is very clear to me. But what I'm wondering a bit about is how do people use this in client-side JavaScript programs? I mean, obviously there can be template languages written for JavaScript that work inside...

Regex behaving differently in IE6/IE7

My HTML is something like this : <select> <option>ABC (123)</option> <option>XYZ (789)</option> </select> What I'm trying to do is: using JQuery and a regex, I replace the "(" with <span>( here's my JQuery line: $(this).html($(this).html().replace(/\(/g,"<span>(")); It's working as intended in Firefox, chrome and safari, ...

jQuery event only every time interval

$(document).ready(function() { $('#domain').change(function() { // }); }); The code inside the change function will basically send ajax request to run a PHP script. The #domain is a text input field. So basically what I want to do is to send ajax requests as user types in some text inside the text field (for example...

Find Hover CSS Attribute

Lets say I had an element with multiple classes, one of these classes has a hover pseudo-class. Lets say this will change the colour. So what I want to do is find out what colour the element will change to when hovered over. Then I want to override this with Javascript/jQuery. ...

Why does this XUL code works and the Javascript equivalent doesn't?

xul way: <toolbar id="PersonalToolbar"> <toolbarbutton id="Testing-Doit-Button2" class="bookmark-item pagerank" tooltiptext="Do it!" oncommand="testing_doit();" /> </toolbar> javascript way: function createBookmarkItem() { const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; va...

adding form elements with javascript - they won't submit

This is similar to the problem here: .../questions/1386228/add-form-element-dynamically-using-javascript-not-submitting but I don't know what his answer was besides rewriting from scratch. Here's my problem: Form elements added dynamically to the page do not appear in the $_POST array. I'm doing this same method several other instances...

Calling a jQuery plugin without specifying any elements

Say I have the following jQuery plugin: $.fn.myPlugin = function () { //plugin code } Normally, you call a plugin on a certain number of elements, like such: $("body").myPlugin(); Is there any way I can call my plugin without specifying an element? I have tried calling it like such: $.myPlugin();, but that does not work. Wh...

Catching a custom javascript exception with window.onerror - in IE

I have a custom exception class which I'm using for a particular situation. It could be thrown from anywhere so try/catch isn't really practical. throw new CustomException; I want to catch this error in window.onerror and filter it out, which works fine in most browsers I've tested so far. var window_onerror = window.onerror || func...

Javascript & Firefox - Detect if window.open opens in a tab?

I'm doing some work with the new Facebook js library, http://github.com/facebook/connect-js. There's one thing that bugs me, which is that when you are using Firefox and have the option "Open new windows in a new tab instead" enabled, the login popup opens in a new tab and then resizes the entire browser. It doesn't restore to the origin...

How to save values with loop

Hey guys, I am trying to add the returned value from the test() function into a the variable result, but += does not seem to work. I get the error "invalid variable initialization". I also tried replacing i++ to i+= which didnt work either. Maybe I'm totally wrong and should use a while loop instead? I'm quite lost.. I want 'result' to ...

Multiple left-hand assignment with JavaScript

var var1 = 1, var2 = 1, var3 = 1; This is equivalent to this: var var1 = var2 = var3 = 1; I'm fairly certain this is the order the variables are defined: var3, var2, var1, which would be equivalent to this: var var3 = 1, var2 = var3, var1 = var2; Is there any way to confirm this in JavaScript? Using some profiler possibl...

Why doesn't "doScroll" work in IE8?

Is "doScroll" still supported by Microsoft in IE8? I can't get it to work at all. Here's a test page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <body> <div id="a" style="overflow:auto; width:300px; height:300px; border:1px solid black;"> <div style="widt...

Fix a warning thrown by HTML Validator

Hi I have some JavaScript code in my php website. This code uses jQuery, and builds a < select > menu using ajax calls. Here is the code sel.append('<option value="' + data[i].id + '">' + data[i].nombre + '</option>'); And this gives me the following warning line 240 column 82 - Warning: '<' + '/' + letter not allowed here Does any...

Accessing content of a other page in a Google Wave widget?

Is there a way of accessing contents of a other page into a Google Wave widget? And also sending post requests to the other server? Like an iframe behaviour? ...

Help with my first own object in JavaScript/jQuery

I have written a PHP script that checks whether a domain is available for registration or not. To automate the process, I have also written a js script that automatically sends AJAX calls to the PHP script and tells the user whether the domain is available or not, without submitting the form: $(document).ready(function() { functio...

Using jQuery inArray with array of JavaScript Objects

Hello all, I'm working with an array of JavaScript Objects as such: var IssuesArray = [{"ID" : "1", "Name" : "Issue1"}, {"ID" : "2", "Name" : "Issue2"}, {"ID" : "3", "Name" : "Issue3"}]; My end effort is trying to remove an object from the array when I know the ID of the object. I'm trying to u...

jquery conditional logic for currentpage

I'm using jQuery for a vertical site navigation menu, all links within site. I have the basic functionality working, but am at a loss as to the correct if-else to accomplish the following: As the code stands, the submenu items are always initially hidden, but I want them to start shown if the user-selected li or one of its child lis is ...

Google Analytics Tracking Code and Document.write causing requests to localhost?

Google Analytics recommends that the code below be inserted before the </body> tag on all web pages on our website to enable visitor tracking. <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytic...