javascript

How to load file from inside Firefox plugin

I'm working on a Firefox plugin which contains a file holding some HTML data. How do I load in this file as a string? I can do var contents = Components.utils.import("resource://stuff.html"); but that then tries to execute the XML file as Javascript. I just want its contents! ...

ASP.Net User Control Java Script function does not run

I have the function put here like below: $(document).ready(function () { UserControlNameInit(); }); The script are put in the following and the block is in the .ascx page. <script type="text/javascript"> </script> However, the function UserControlNameInit() does not run when the page loads. It is showing in the page source. I ...

prototype a div into a input

Html5 allow me to do this DropDivContainer.addEventListener("drop", handleDrop, false); Then do something like handleDrop = function(event){dt = event.dataTransfer}; But can the DropDivContainer be made to select a file, like a html4 input? <INPUT TYPE=file NAME="html_file"/> I would like to prevent the use of a hidden InputCont...

Accessing paramaters in a js file url

How can I access modules in my js file: <script type="text/javascript" src="script.js?modules=test,cookie"></script> ...

WP site gets totally messed up, when using JW player embed codes

Hi, I'm experiencing a severe bug on my Wordpress site. http://kungfuscreen.com/ When the homepage loads, after 2-3 seconds, the pages refreshes and multiple JW players (which are taken from the posts) are splashing on the screen in one big mess. the site uses a pro theme for a video content site, and each post contains a JW video pla...

Update pie slice size in Raphael pie chart

I'm working on making a pie chart that shows results over time. As such it needs to animate between states to show how different slices change. I've figured out how to change all the slices en masse (using this example as a starting point), but I would like to be able to select and manage a particular slice (or sector as Raphael calls it...

Get reference to anchor's dom element from javascript

If I have a some javascript in an anchor's href attribute: <a href="javascript:alert('hello!')"> Is there a way I can get a reference to the DOM element that was clicked when the script executes? I mean, I know I could do <a href="javascript:alert('hello from '+document.getElementById('thisAnchor'))" id="thisAnchor"> But I was ho...

javascript get value from dropdown

Hi, I have a php script with an array which loops through months and displays them in a drop down. I want to get the selected value from the drop down using javascript. function month_list() { $months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); ...

$.ajax json method does not hit the web method

When this function is hit , it does not call my function in code behind? Why could it be doing this? How can I fix this error. $(document).ready(function() { $('[id$=btn_Update]').click(function() { var reten = $('[id$=txt_Reten]').val(); var i=0; var selectValues = ""; var Pr...

Function not defined

I am getting a function not defined error with my jquery script and i'm not sure why. JQuery Code: <script type="text/javascript"> $(document).ready(function(){ var dealerName = $('.name', '.adr').text(); var customerName = dealerName.slice(0, - 1); var customerAddress = $('.street', '.adr').text() + ', ' + $('.locality', '.a...

How to get local date with correct timezone (with daylight savings) using only hoursOffset and minutesOffset

I need to a date to the user's timezone. I know the hours and minutes offset of the timezone. So, I have two variables hoursOffset and minutesOffset. I need to figure out the timezone from that, if daylight savings exists right now, and then get the correct local date with javascript. I'm not sure how to check if daylight savings ex...

jsFiddle clones?

Are there any other websites out there that offer similar functionality to http://jsfiddle.net/ ? What are the pros & cons of each? ...

What is the PHP equivalent of this JavaScript Regular Expression?

return str.replace(/[\(\)\.\-\s,]/g, "") ...

Passing a variable from created in function a to function b when function b is inside function a

I have a function for the class .myclassA, inside this function I capture the id of the particular element chose and I put it inside a variable inputid. This function also brings another function for another class(.myclassB), which is inside the first function. Do you guys have any idea how I can pass the variable inputid from the first ...

jquery counting function. if statement

I am trying to write a bit of jquery to: if there is only one instance of the div which has a class of "option" take the href attribute and redirect to that href, this is what i have to far <script type="text/javascript"> var count =('Size: ' + $('.option').size()); if (count = 1) { $('.readmore a').each(function () { v...

Why onchange doesn't work?

Hi! I'm just looking for an answer on the net but I haven't reached any one. I'm playing with google's api translation and I have a problem with JS. In fact my code is 100% ok except one operation. My problem is that the translation is not given at the time. After js sends the information to google it doesn't wait until the translation...

Getting the flash object using the DOM

I am embedding a flash video using the SWFObject static publishing option. The code is found at: http://code.google.com/p/swfobject/wiki/documentation I am embedding a youTube video and want a javascript function to start playing the video. I have tried using the document.getObjectById and document.getElementById methods. Neither of the...

jquery help selecting the parent

I have this HTML <li> <a rel="1" href="/jobwall/job/1"> <img src="http://lcl.moovjob.com/media/images/employers/simonainleydotinfo.jpg"&gt; </a> </li> and I have this javascript $('ul#jobs li a').mouseenter(function(){ $(this).parent().addClass('active'); $.ajax({ type: 'POST', url: '/jobwall/j...

Cloning a JavaScript object?

This is another way to create a javascript object (using object literal notation instead of function): user = { name: "Foo", email: "[email protected]" } Is there a way to clone this object or is it a singleton? ...

Get all iframe elements

Hey guys I'm showing a loading indicator while some external iframes are loaded with the following code : <html> <head> <title>Loading iframe</title> </head> <script> function loading_iframe(){ document.getElementById('loading_iframe').style.display = "none"; document.getElementById('loading').style.display = ""; d...