javascript

How to check if a swf is loaded using JavaScript with swfobject?

I have the following swf: <head> # load js <script> function graph() { swfobject.embedSWF( "open-flash-chart.swf", "chart", "400", "180", "9.0.0", "expressInstall.swf", {"data-file":"{% url monitor-graph %}"}); }; </script></head> <div id="chart"> </div> <script> graph(); </script> I would l...

ajax call error for list view data item.

function manageVoting() { var parameter; var myVoting; var divVoting; var divVotes; var value = -1; var parameterData; $('div.votemaincontainer').each(function() { parameter = $(this).find('#[id$=hfUrl]').val(); myVoting = parseInt($(this).find('#[id$=hfMyVote]').val()); divVoting = $(t...

Case insensitive regex in javascript

Hi I want to extract a query string from my URL using JavaScript, and I want to do a case insensitive comparison for the query string name. Here is what I am doing: var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (!results) { return 0; } return results[1] || 0; But the above code ...

AjaxFileUpload SyntaxError: missing } in XML expression

I'm trying to upload a file using $.ajaxFileUpload. My server script is returning a json object eg. {"imgName": "test.jpg", "imgUrl": "/uploadtest/images/profile/sam.jpg"} When I check in firefox it shows the correct response. Json is also received. But still I'm getting an error in alert: SyntaxError: missing } in XML expression I...

What's wrong with this javascript code?

var act = false; var newprod = prompt("tell me somthing", ""); if (newprod != '' && newprod != null) { $.ajax({ //posting code here }); } if (act != false) { document.location.href = window.location; } The page is refresh in every condition even act false or not. It is fired on an event. Can anyone tell me why it page is re...

style and script tag sequence

Normally HTML page contains following tags <script> <link> <style> I found number of times that changing the sequence of those tags, mess up with page layout. So what would be the reason and what are the points to avoid this situation? EDIT After looking the answer of @Anurag, I'm actually assuming that we don't have a case where ...

Google Chrome Extension Javascript Unexpected Token Illegal

This may seem familiar, but I can't find anything about it...sure I've found stuff about "Unexpected Token Illegal," but these circumstances don't relate enough for those solutions to make sense. I have my background page, like so: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-tr...

How to prevent JavaScript Injection Attacks

Currently I have developed a site which is used for handle financial transactions. I have seen that some of my customers have done JavaScript injection attacks and have done some transactions which are not possible. As a example I have checked his cash balance before he place the order. But some of them did change that by running the fol...

on unload event of browser

HI I wanna timeout session from client page,i tried below code but not able to execute code need some help of how i can handle OK or CANCEL events from user <script> function onBeforeUnloadAction(){ return "Would u like to discard Changes"; } window.onbeforeunload = function(){ if((window.event.clientX<0) || (windo...

Chrome extension to append tab index to title

I am trying to create a simple extension in chrome that appends the tab index number to the tab title. This is my first attempt at creating an extension so I don't have much experience. I would appreciate it if someone could point out what I am doing wrong. { //My manifest.json "name": "Tab Selector", "version": "1.0", "descript...

numeric marks field validation

Hi all, I want numeric javascript validation for marks field. Marks entered should be out of 5 means user can enter upto 5 marks not more than that. marks may be in decimal like 4.25 after decimal there should be 2 digits can any one help me.. ...

iPhone Cache Manifest Problem

Hi, I've been trying to setup a cache manifest for an iPhone WEB Application. I have included: <html manifest="speed.manifest"> However, something isn't working. I have configured easyPhp to deliver manifest with the mime.types file and also added AddType text/cache-manifest .manifest to the httpd.conf to try this also. It unfortunate...

problem in lightbox for video ?

i am using a thick box for flv player, when we click on the link for video (these videos list coming via AJAX), large size of videos are not playing, i think it is buffered, how can play the large videos? i am using flv player downloaded from www.adobe.com. ...

How to increment a value of the table cells?

I can't understand how to increment a value of the table cells like: 1,2,3 etc? My code: $('#table').each(function(i){ $(this).find('td:nth-child(1)').text(i); }); Please, look at the full example ...

Jquery and dynamic table row updates, painful performance

Hello Some is bugging my mind lately, a website I develop has an ability to add new rows to the table via javascript and each time I add a row I have to apply plugins to each row as such: Assuming .data is my table id: $('.data tbody tr').each(function(idx) { $("input:text", this).setMask(); $(this).bindTooltip(); syncRowSt...

Marks field validation

Hi all, I want numeric javascript validation for marks field. Marks entered should be out of 5 means user can enter upto 5 marks not more than that. marks may be in decimal like 4.25 after decimal there should be 2 digits can any one help me.. My text box is inside the data grid so on item data bound iam doing coding like If e.Item.It...

What events does an <input type="number" /> fire when it's value is changed?

Just wondering whether anyone knows what events an HTML5 <input type="number" /> element fires when it's up / down arrows are clicked: I'm already using an onblur for when the focus leaves the input field. ...

iOS4 Media Control Javascript Events?

I'm not sure if this is exactly what I'm looking for, but I've noticed the iOS4 media controls (double tap home button and slide left to see them) have some control over the HTML5 Audio elements, but is there any way to do a callback for previous and next songs? if so does anyone know the way I can tap into these callbacks? :) Thanks ...

Mouseover/leave problem

I have a span that includes an anchor and a span. Example below <span id="x"><a id="a_in" href="">link</a><span id="x_in">x</span></span> Now I am attaching a mousenter / mouseleave event on the span with id="x". When I mouse over the the span id="x" it triggers the mousenter / mouseleave that's fine. The problem is when I mouseover t...

import java class in js

Hi, I have a html website and I am using JavaScript. I have a java Class transformation.java with a method convert(a,b) that I would like use in the javascript in my html document. How can I import the java class in my java script and use the method convert(a,b)? Thanks. ...