javascript

Change style of text field based on the selection of a combo box using Javascript

I would like to change the style of a text field based on the value selected in a combo box. Specifically, what I'd like to do is make the txtDepartment field gray and marked as "read only" if the option value selected in cboSource is 1. I've tried the code below, but I imagine my style code at least is wrong, if not other things. Any...

What benefits are there to storing Javascript in external files vs in the <head>?

I have an Ajax-enabled CRUD application. If I display a record from my database it shows that record's values for each column, including its primary key. For the Ajax actions tied to buttons on the page I am able to set up their calls by printing the ID directly into their onclick functions when rendering the HTML server-side. For exa...

Is better: <a href="/test" onclick="T.actions.addFriend(profileId)">add friend</a> or ...?

Is better: <a href="/test" onclick="T.actions.addFriend(profileId)">add friend</a> or <a href="/test" class="add-friend-button">add friend</a> and then with the javscript select the "add-friend-button" class and add a click event? ...

What is the best way to implement search on my site using google search?

Hi, I'm developing a simple site for local student contest. I want to implement some basic search functionality (just a textbox with submitButton or submitLink). The site contains several pages with static informational content there, and one google-forms iframe(register for the event). Is it a good idea to implement my search with ...

Limit number of results per screen

Hi all, I need modify this code (is a search engine) http://www.gamarod.com.ar/javascript/ejemplos/85-buscador-javascript-search-javascript.htm ...I need that the user choose the amount of result per screen Please help me! Thanks. ...

ASP.NET radiobuttonlist onclientclick

I've noticed there is no OnClientClick() property for the radiobuttonlist in the ASP.NET control set. Is this a purposeful omissiong on Microsoft's part? Anyway, I've tried to add OnClick to the radio button list like so: For Each li As ListItem In rblSearch.Items li.Attributes.Add("OnClick", "javascript:alert('jon');") Next But a...

javascript. Select part of an image

Scenario. I want to identify things in an image by 'drawing' a rectangle round them. E.g. to select a face in a crowd. A sign in a street etc. How to use the mouse events to a) mousedown to start select area Grow a 'rectangle' to follow the mouse movements. b) mouseup to end selection. Retrieve the xy, xy of the box for use in furthe...

How can I highlight the corresponding titles of clicked links?

I'm writing an XSL file that contains a side-nav menu with a list of links. When the user clicks on one of the links, the page jumps to the corresponding table of information for that link. How can I make it so that when the link is clicked, the title of that table (not the link itself) is highlighted? It should also un-highlight if anot...

Cut and Paste Code Reuse - JavaScript and C#

What is the best tool(s) for tracking down "cut and paste reuse" of code in JavaScript and C#? I've inherited a really big project and the amount of code that is repeated throughout the app is 'epic'. I need some help getting handle on all the stuff that can be refactored to base classes, reusable js libs, etc... If it can plug into Vis...

bootstrapping AHAH without full page load

I've written some modal box functionality that loads HTML into the DOM as snippets. This includes AHAH-enabled forms. I've got as far as pulling out the AHAH settings, and can re-initialize: jQuery.extend( Drupal.settings, response.setting ); I can also re-initialize: Drupal.attachBehaviors( container ); I've even ensured that aha...

IE8 compatability mode

How do you detect in JavaScript running in an IE8, whether the browser is using compatability mode or not? ...

IE won't load PDF in a window created with window.open

Here's the problem, which only occurs in Internet Explorer (IE). I have a page that has links to several different types of files. Links from these files execute a Javascript function that opens a new window and loads the specific file. This works great, unless the file I need to open in the new window is a PDF in which case the windo...

DRY URL's in Django Javascript

I'm using Django on Appengine. I'm using the django reverse() function everywhere, keeping everything as DRY as possible. However, I'm having trouble applying this to my client-side javascript. There is a JS class that loads some data depending on a passed-in ID. Is there a standard way to not-hardcode the URL that this data should come...

Can you recommend an in-browser Ruby/Rails 3D renderer?

I want to draw some 3D network diagrams in a web browser, and the data for these diagrams are in a Rails app (in the database). I already use flotomatic as a Rails interface for pretty Javascript plots (e.g., independent variable, dependent variable). Certainly there are packages for drawing simple things in Javascript. What I'm lookin...

Shuffling words in a sentence in javascript (coding horror - How to improve?)

Hi, I'm trying to do something that is fairly simple, but my code looks terrible and I am certain there is a better way to do things in javascript. I am new to javascript, and am trying to improve my coding. This just feels very messy. All I want to do is to randomly change the order some words on a web page. In python, the code would ...

Javascript - find swfobject on included page and call javascript function

I’m using the following script on my website to play an mp3 in flash. To instantiate the flash object I use the swfobject framework in a javascript function. When the function is called the player is created and added to the page. The rest of the website is in php and the page calling this script is being included with the php include f...

Can I connect to SQL from JavaScript MVC?

I am populating a list of names that will be added to my Sql Database. In this simple case, how do I send the information to SQL server without my page being refreshed? <script type="text/javascript"> function addNewRow() { $('#displayPropertyTable tr:last').after('<tr><td style="font-size:smaller;" class="name"></td><td style="fo...

How is the "jQuery" var a function and an object?

For example, when you use jQuery('someDiv');, it's a function, but you can also use jQuery.ajax(...);. How is it possible? ...

javascript select box hanging on second select in ie7

I have a drop down select box inside a div. When the user clicks on change, a dropdown box appears next to the change/submit button and the user makes a selection which then updates the db and the selection appears instead of the dropdown. All works fine in IE8 and firefox but in IE7 it allows one selection (there are several identical...

Javascript Spliting Strings

Dear experts, I came across an block of Javascript code to split a paragraph with the dom structure. The code is as follows: string.split("<b" + "r>"); I am a little confused as to why do they have to use a PLUS SIGN and split the parameter into lookup strings? Why not just use string.split("<br>"); Is there a technique or bro...