javascript

JavaScript innerHTML

Why doesn't this work? innerHTMl cannot take in sth so complicated? <html> <head> <script type="text/javascript"> function addTable() { var html = "<table><tr><td><label for="name">Name:</label></td><td><input type="text" id="name"></input></td></tr>"; + "<tr><td><label for="remarks">Remarks:</lab...

getting a radio button dynamically with jquery

Hi, I have tried this for too long... too big for me. I need a little help here. I have a page with products. each product got 3 sizes (normal, big, special) The user is selecting radio button to choose the size and then hits the "add to cart". I am trying to get the value he chose, but without any success. Right now I found that jQuer...

embed Javascript in .bat files.

Hi, Is ther any way to execute javascript from a .bat file or embed the javascript in .bat file. I need a javascript code to write/read to a file in a local folder.This javascript i should be able to execute it using a .bat. Is it possible?. Thanks SNA ...

Draw polygon using mouse on google maps

I need to draw polygon using mouse and mark a particular area on Google maps. The purpose is to mark an area on Google maps and then showing hotels and attractions on that area. The user will mark the hotels on Google map while creating them so the db will have their latitude and longitudes. How can I draw the polygon and fill it with ...

How to apply jQuery live() function to this code?

As mentioned i would like to know how i can apply the live() function to this code. This code will be inserted by javascript: <a class="link" href="url"><span>This content is hidden</span></a> This is the javascript that needs to be live: $('.link').append('<span class="hover"></span>').each(function () { var $span = $('> sp...

Assigning scope amongst jQuery.getJSON and a JS.Class

I'm trying to assign some JSON data to a property of a JS.Class instance. var MyClass = new JS.Class({ initialize: function(uuid) { this.uuid = uuid; }, write: function() { $.getJSON(url+"?callback=?", {}, function(data) { Assign(data); }); function Assign(data) { this.content = data; }; } }); var m = ne...

Radio button validation (dynamic name)

I have a list of radio buttons. Each radio button has a dynamic name. Is there a way to check if they are all selected? Because most radio validation scripts uses a static name. ...

open popup in IE

hi window.open(address,'Audio Player','width=340,height=30,directories=no,location=no,menubar=no,resizable=no,scrollbars=no, status=no,toolbar=no'); this is my code which is not working in IE. bu i want in IE.can any one suggest me to how ...

Prevent selection in HTML

Hi, I have a div on a HTML page and whenever I press the mouse and move it, it will show that "can't drop" cursor like it selects something. Is there a way to disable selection? I tried CSS user-select with none without success. ...

Javascript Function-Pointer Assignment

Consider this javascript code: var bar = function () { alert("A"); } var foo = bar; bar = function () { alert("B"); }; foo(); When running this code I get "A". Is this behavior a part of javascript specification and can I rely on it? ...

Wysiwyg Tiny MCE, problem adding custom links

I am trying to see witch one i like best, Tiny MCE or CKEditor. The problem that i am getting is that i need to add a custom toolbar button (or extend the anchor button). Trying now to modify the advlink plugin to insert internal links from the CMS. So i modified the page link.htm and added one button next to the href field. This button ...

How to Load Google's jQuery in External Script?

Stupid question, but does anyone know how to load google's jquery from an external script so it doesnt clunk up my header? In other words, I want to take the code below (probably starting at the google.load stuff and save it inside another file to include in my header. I want to keep my view source pretty :) <script src="http://www.goog...

Javascript ContextMenu in IE7

We are using div tag in aspx and javascript functions to show context menu in our web application. In IE6 the sub menus in the context menu are getting displayed at the correct x and y coordinates what we have hard-coded in our application. But in IE7 and IE8, the sub menus are getting overlapped and in some machines the menus are going ...

How to setup javascript redirect to send user to back page? see code

Hello, with onclick="history.go(-1);return false;" user can navigate to back pages. but if I want to put a confirm method before it takes user to the back.. how would I do that? I think it can be achieved by doing something like below but I am not sure how to redirect user to back page? $('.clickme').click(function() { if(confir...

Firefox (v 3.6 [and possibly other versions] not resetting variable values on page refresh

I am working on an administration page to add an article to a site. Two of the fields ("Tags" and "Resources") begin with only once instance labeled "Tag 1" and "Resource 1" respectively. Using jQuery, I allow the user to add additional tags and/or resources ("Tag 2", "Tag 3", etc) and it works ALMOST as I want it to. If the page has b...

What is wrong with this simple javascript function to swap the CSS class of an HTML body?

I've been staring at this for too long. I've put alerts throughout and the flow is correct. The styles exist. The body starts with the "styleBlack" class. The condition of the if statement is met and the body's class becomes "styleLight". A second call meets the condition of the else statement but the innerHTML of mDiv does not chan...

Need to call client script before a Response.Redirect. Any suggestions?

I have a page that when the user clicks a button there is a custom loading panel placed in the update panel by the PageRequestManager BeginRequest event. So when the page is loaded the loading panel is removed. My issue is that when the user clicks a button that redirects to an httphandler the page is not reloaded therefore the loading p...

Using jQuery selectors with normal Javascript?

I'd like to be able to do: if ($("cheese_tag") == document.getElementsByTag("cheese_tag")[0]){ alert("success!"); } Is this possible? Basically what I'm wanting to do is use the ease and power of jQuery selectors to manipulate elements. Is what I'm talking about possible? REVISION: Sorry, a better way to state my question would be "C...

A javascript function to format javascript code

Does anyone know of a javascript library that will take a chunk of javascript source and format it according to some set of rules. I can of course do it in my editor but I would like to be able to automate it as part of a build process. ...

How do I morph a class with Scripty 2?

In Scriptaculous 1, you could animate styles: new Effect.Morph('id', { style: { background: tomato }, duration: '4' }); But a better way was to keep the CSS and JS separate and merely reference a class: new Effect.Morph('id', { style: 'important', duration: '4' }); Marvellous. But this doesn't seem to work with the new Scripty 2. W...