javascript

Set a variable in an Iframe

Is it possible to create an Iframe using document.createElement("iframe"); and then set a variable in the iframe's window object such as a namespace? I have tried doing something like this: var Namespace = {}; var iframe = document.createElement("iframe"); iframe.src = "page.html"; document.body.appendChild(iframe); var iwin = ifram...

How to dynamically update jQuery Flot from Native JSON.

Prior Information: (In case you are wondering where I am coming from) First Question: How to set a JS variable every n sec to a JSON array. Thanks to help got that all going well :) I then worked on limiting the total amount in the array, tried to set it to 10 but every time it would stop at 7.. with help from here got this working ni...

Event is undefined in IE6 but works fine in Firefox, Chrome etc.

IE6 is getting to be pain but it still makes up (apparently) a good chunk of the browser market share, so I need to make this work. function getPosition(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { var dex = document.docum...

Generate Excel file using javascript

Hi all Is there any simple way to generate an simple excel file using JavaScript? Best Regards, ...

jQuery ajax function not working in Safari (Firefox, Chrome, IE okay)

I'm no javascript wiz, but am a bit puzzled as to how this is working in three major browsers, but not Safari... is there something wrong with this code? Basically I'm just using this in conjunction with a php/mysql callback at the given url to track link clicks. Drupal.behaviors.NodeDownloadCounter = function() { $('a.ndc-link').c...

$.slideToggle() & $.hover() animation queue issue

I'm trying to set up a pretty basic hover animation in jQuery. Mouse over a div and the major content is slid down, mouse up and it slides up. <script type="text/javascript"> $(function () { $('.listItem').hover(function () { $(this).find('.errorData').slideToggle('slow'); }); });</script> This piec...

Looking for inline html editor

Hello, I'm looking for a simple javascript html editor that support: using div(contenteditable) insteal of using iframe auto resize content height when typing. support some functions: bold, italic, orderedlist..., could plugin more toolbar button in the furture. Thanks ...

How to hide div by onclick using javascript?

I have used a javascript to show div by onclick but when i click outside div i want to hide the div. How to do it in javascript? i'm using javascript code.. <a href="javascript:;" onClick="toggle('one');"> function toggle(one) { var o=document.getElementById(one); o.style.display=(o.style.display=='none')?'block':'none'; } ...

asp.net Function.createDelagate pass argument

In SharePoint 2010 I have a function call where I want to iterate recursively down the the webs using the javascript OM. For this I have to repeatedly call the executeQueryAsync method. For the (success) delegate method I need to pass the collection of the current node level. I see that the signature of the delegate method has an args...

Change id of a Table row using javascript in IE

Hello I have a table which has a few rows. And I have an add button in my application which allows to add rows at any rowIndex. I use insertRow method to insert rows at a specific position. So once a row in inserted, I change the table row Ids of all the rows, to arrange them in an ascending order. Now I have been developing this applica...

How to prevent HTML5 Web Workers from locking up thus correctly responding to messages from parent

Hi guys, I'm using web workers to do some CPU intensive work but have the requirement that the worker will respond to messages from the parent script while the worker is still processing. The worker however will not respond to messages while it is locked in a processing loop, and I have not found a way to say poll the message queue. ...

get entity value at client side in MS CRM (javascript)

Hi, Let say I have the entity Branches, which have vale a,b,c,d,e... I want to show these value on another entity's New form as picklist field. what have to do. Is need to write the javascript so that I can get the value of Branch entity and assign to picklist field in another entity. please i am new in MS CRM, guide me. please. ...

How to format time since xxx e.g. “4 minutes ago” similar to Stack Exchange sites

The question is how to format a JavaScript Date as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow. e.g. 1 minute ago 1 hour ago 1 day ago 1 month ago 1 year ago ...

How to format numbers similar to Stack Overflow reputation format.

I want to convert a number into a string representation with a format similar to Stack Overflow reputation display. e.g. 999 == '999' 1000 == '1,000' 9999 == '9,999' 10000 == '10k' 10100 == '10.1k' ...

PHP/Javascript iFrame redirect SSL error

Hi guys, I have a problem with a redirect I am trying to do from within a iframe, I keep getting a SSL certificate error, is there a specific way should be redirecting from within an iframe? I am usig this code, echo "<script type='text/javascript'>top.location.href = '$redirect';</script>"; I have also tried a standard PHP header r...

RegEx (in JavaScript find/replace) - match non-alphanumeric characters but ignore - and +

We have been using the following js/regex to find and replace all non-alphanumeric characters apart from - and + outputString = outputString.replace(/[^\w|^\+|^-]*/g, ""); However it doesn't work entirely - it doesn't replace the ^ and | characters. I can't help but wonder if this is something to do with the ^ and | being used as meta-...

Javascript Comments are security risk?

During a recient PCI audit the auditor said that we had major security risks because It was possible to download static resources from our website such as images css and javascript without prior authentication. Our javascript had comments in it. Personally I think that this is not a security risk at all. The images css and javascri...

Send data to database when click on a link without page refresh

Is there a way to send data to database when click on a link without page refresh? I use php/mysql... ...

Dynamic (2 levels) Javascript/CSS Loading IE6

Hi all, i am trying to dynamically include js (and css) files into a webpage like this: index.html -> loader_a.js -> a_foo.js, a_bar.js, a_foo.css and so on. While this works without a problem in FF (using appendChild) i cant get it to run in IE6. I've tried various available solutions (adding to dom node, ajax call and eval and more fro...

Javascript enable button ie6

I have a change password screen and when the 2 passwords match i need to enable the save button. It works with IE8 + IE7 but fails to enable the button in IE6 var LblError = document.getElementById('ctl00_cphValNet_LblError'); var Pwd1 = document.getElementById('ctl00_cphValNet_txtNewPassword') var Pwd2 = docume...