javascript

How to add this javascript made table into the page ?

I have this function which gets some variables and adds shadow to them, and the displays them in a table. My Question is, how can I add the table into the DIV, which I have on my page? It's probably really easy, just that Im new to javascript. Thanks! function drpShadow(pic_url, width, height) { var i; var pic_display ...

Detecting when an <embed> element has loaded an audio file

Hi, I'm using a jQuery plugin (http://www.soltanrezaey.com/bssound/demo.html) to add very basic audio-playing capabilities to a web page. The plugin works by creating an 'embed' element (I know, I know...), setting its src to the audio file, setting the autoplay attribute to true and appending it to the page. Despite the use of the dep...

How to escape a double-quote in inline c# script within javascript?

How can I make the following inline c# work within javascript? I have had no luck with escape characters, but I am sure I'm just doing something wrong. var inputId = "<%= applicationForm.FindControl("myInput").ClientID %>"; ...

How To Access jQuery Event Without Using Anonymous Callback Parameter

Hello all, Typically, when needing to access an event, you do so via the parameter specified in the callback function: $button.live("click", function(ev) { // do something with ev here, like check 'ev.target' } But instead (for reasons too complicated to get into here), I do not want to use an anonymous callback function, but inste...

catch 'hover' event while dragging

I'm using jQuery-ui draggable and droppable in my page. basically I'm implementing an accordion, where you can drag an item from one section and drop in another. I don't use jquery-ui accordion - I simply want to reveal the relevant section and hide the others when the time is right (when you hover over a section header while dragging). ...

IE scales background-image on DOM ready

On this project http://jackson.collegeman.net In IE 7 on WinXP and IE 8 on Vista, when the page loads, the background image behind my nav bar buttons scales to fit the anchor tags it's set on. The background-image is a composite of all the buttons for the navigation bar, containing both normal and hover states. For some reason, in IE,...

Accessing Parameters *and* Events in function from jQuery Event

Hello all, This is a follow-up question to a different question I asked not too long ago. Typically, you can access an event in a function call from a jQuery event like this: $item.live("click", functionToCall); and in the function: function functionToCall(ev) { // do something with ev here, like check 'ev.target' } But what if ...

XUL How to create autocomplete with behaviour similar to context popup.

I need autocomplete feature to be added into the editor which is iframe inside < browser >. The behavior should be similar to context menu (so popup should be shown near the text cursor) but because context menu attribute is already occupied (this menu works fine) by another functionality I can't use it. Is there any natural way to do th...

JavaScript context

var User = { Name: "Some Name", Age: 26, Show: function() { alert("Age= "+this.Age)}; }; function Test(fn) { fn(); } Test(User.Show); =============== Alert shown by code is "Age= Undefined". I understand as User.Show function is called from inside of Test(), refers 'this' of 'Test()' function rather than 'User'...

How to use jQuery in affiliate sites?

Let's say I want to give my partners a simple <script src> tag to include some dynamic content on their site, loading from my site. Is there any way I can use some javascript framework in my .js file so I can do some more fancy things? jQuery? I assume this is a problem as it might conflict the site's own javascript code? What if they a...

jQuery form zip code to state function

I'm trying to convert a preexisting javascript function into a jQuery function. The function comes from http://javascript.internet.com/forms/zip-to-state.html and aims to convert a user-entered zip code into a state. I'm using jQuery 1.3.2, with all the necessary plugins, but I'm not very familiar with jQuery syntax and how to convert th...

DIV width and height wont resize when setting innerHTML ?

When I set an image to the innerHTML of a DIV container, the width and height of the DIV is still not changed. The div has border:solid style and the border is like "outside" the image... So the image is shown fully, but it streches outside the div borders, but still shows anyway. Is this a problem ? Should I use the DOM method instead...

XUL key tag uage

I need to bind key shortcut to $ sign for < key > in XUL I tried keycode="36", modifiers="shift" key="4", key="$" but nothings seems working. Is there any way to do such thing? ...

JS event handlers. Creating nice CSS button with jquery and integrating with jquery.validate and/or jquery.form

So, i'm writing a plugin using js with jQuery, that will replace all buttons (input type=submit and <button>) on my site's pages with nice buttons that look something like <a href='#'><span class='label'>Ok</span><i></i></span> At the very beginning i ran into trouble: some of my buttons don't just submit the form - some are hooked with...

how to add array element values with javascript ?

I am NOT talking about adding elements together, but their values to another separate variable. Like this: var TOTAL = 0; for (i=0; i<10; i++){ TOTAL += myArray[i] } With this code, TOTAL doesn't add mathematically element values together, but it adds them next to eachother, so if myArr[1] = 10 and myArr[2] = 10 then TOTAL will be 10...

Jquery replace string

May sound like a total noob question but i'm looking for a javascript (and or jquery) function to replace an element in this code : <embed id="ply" width="800" height="400" flashvars="file=http://example.com/play/" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#00000" name="ply" style="" src="/vide...

prototype next function

I have prototype 1.5 and I can't get the "next" function to work: Event.observe('sameAsBefore', 'click', function(item){ checkbox = Event.element(item); if (checkbox.checked == true) { checkbox.next('address1').value = $('hidden_address1').value; } } Together with the following html: <div class="some_div"> <a ...

how to call this javascript function from inside another function ?

pic_display+="<img src='"+pic_url+"' onClick='swapImage("+pic_url+");'> I am adding an image to the innerHTML of a div with the code above. I want to call the function swapImage(pic_url) whenever I click on the image. I have still not figured out the syntaxes in javascript, always confuse them with php. How should it be written ? Th...

Dojo: Select a tab on load depending on url parameter

Is there a way to select a tab in a tab container upon load depending on a url parameter? I have tried the following but nothing seems to happen and the tab I want is not selected: dojo.addOnLoad(function() { tabToSelect = getParameter("tab"); if(tabToSelect){ dijit.byId("container").selectChild(tabToSelect); } } I have console l...

YUI datatable XHR get not using UTF8

OK, so my datasource is serving json and it's UTF8 encoded. Viewing the json result in the browser or Firebug confirms this. But when the YUI datatable displays the results in a table the UTF encoding is lost, resulting in G�teborg instead of Göteborg I see according to the documentation provided by Yahoo that you can specify the conn...