javascript

Google Chrome Extensions: Passing user highlighted webpage text to a browser_action

Hi, I'm working on a Chrome extension where I need to pass highlighted text into a browser_action. I found the following code in a Google Group, and at the time it was written it was still valid - but it doesn't work anymore.. Does anyone know an alternative solution? background.html: <html> <head> <script type="text/javascript"...

Anonymous class with MooTools.

Can I create the anonymous class(java term) using the MooTools js framework? Suppose it should look like: A = new Class({ invoke: function() { alert('class'); } }); a = new A({ invoke: function() { this.parent(); alert('instance'); }, }); But I don't want to modify constructor interface around to accept additiona...

jQuery removing hash value from URL

I have a hard coded URL like so: https://bupacouk.bwa.local.internal.bupa.co.uk/cash-plan-quote/quoteAction.do?getBenefitLevelDetails=getBenefitLevelDetails&amp;productPolicyId=7841#a1 When Javascript is enabled i don't want the hash value on the end so how do i remove it? When Javascript is disabled it needs to be present. Thanks. ...

return true at the end in js function

i have seen in many javascript codes ppl add a "return true" at the end althouhg not necessary anybody know y?? var _globalString; function doSomething() { _globalString= _globalString +' do something'; //some codes to do something more //finally adding a return true return true; } // ...

Open a new window on response with pdf attachment

jqGrid('navButtonAdd',"#pager2",{caption:"Save All",title:"Save & Create Receipt",onClickButton:function () { var s; s = jQuery("#list2").jqGrid('getDataIDs'); alert("selected"); $.ajax({ type: 'POST', url:'http://localhost:3000/order/receipt', data: {ids: s}, }); }}); With ...

Find the first letter of the last word with jquery inside a string (string can have multiple words)

Hy, is there a way to find the first letter of the last word in a string? The strings are results in a XML parser function. Inside the each() loop i get all the nodes and put every name inside a variable like this: var person = xml.find("name").find().text() Now person holds a string, it could be: Anamaria Forrest Gump John Lock As ...

read gsm number from iphone through javascript

Is it possible through javascript to read the number from the iphone. Lets say i have a html page where they have to fill in the gsm number, can javascript read the number from the phone and fill the form with it? ...

Javascript phone number validation

I need to validate a phone number in javascript. The requirements are: they should be 10 digits, no comma, no dashes, just the numbers, and not the 1+ in front this is what I wrote so far function validatePhone(field,alerttxt) { with (field) { if(value.length > 10) { alert(alerttext); return...

Emacs, Django templates and script blocks

I use emacs when working with Django. .py files work great with Python-mode, .js files work great with js2-mode, .djhtml (templates) work great with django-html-mode -- except for Javascript blocks which aren't auto-indented nor highlighted. Does anyone know of a way to get syntax-highlighting for Javascript blocks in Django templates i...

Song Should to be play in Mobile Browser while streaming.

Hi All, I am using Html with Java Script to create webpage. Steps to be follow. Create Folder name as "onlinesongs" and keep this as your parent folder. In that again create one folder name as "songs". Copy 10 mp3 songs into songs folder you have created in second step. Rename all songs which u copied as 1,2,3,4,5,6,7,8,9,10 like so ...

JQuery image overlay (and get rid of imagecopymerge)

Hi friends, In my project site I am merging a base image (a map) with markers (the same marker always but repeated) according to a table in MySQL using the php function imagecopymerge. I want to migrate this to jQuery since the refreshing of the image flicks, which is very ugly. Could you please guide me to the best solution? Thanks...

Sort list box options using mootools1.2

Hi all Below is my HTML <select name="name" id="id"> <option value="1">ZZZ</option> <option value="1">PPP</option> <option value="1">SSS</option> <option value="1">AAA</option> </select> I want that this select box will be sorted according to below. <select name="name" id="id"> <option value="1">AAA</option> ...

JS: Events and variables

Is there a way to raise event where some variable is changed? ...

Is there any way of getting Netbeans code completion to work with XPCOM components?

I'm writing a Firefox Addon in Netbeans 6.8. The Ctrl+space code completion for my own code or native javascript elements is very useful, but is there any way of making it aware of XPCOM (eg so that code completion would suggest the methods of nsIHttpChannel in the following code)? /** * @param {nsIHttpChannel} cSubject */ captur...

Ajax without JavaScript

Hello, As JavaScript can be disabled in the browser by the user, I wonder if there is any way of developing an Application which uses Ajax but it doesn't use Javascript, so even if Javascript is disabled it goes on working. Is there any limitation? Thanks. ...

Trouble closing img tags in Javascript – using strict xhtml DTD

Hi I am using a Javascript called Niceforms.js which makes HTML forms looks pretty. It works fine under the xHTML Transitional Doctype, but I need to build my site using Strict xHTML. It has a few problems rendering under Strict and I'm fairly sure it's because it isn't putting the trailing slash in a few <img> elements so that they ...

How to find an element inside another element in mootools

Let's say i need to find all .bar elements inside an element that's assigned to a variable foo. In jQuery, foo.find('.bar') solves the problem. What's the equivalent function in mooTools? ...

Is window.opener reliable?

Is JavaScript's window.opener property reliably available across browsers, and immune against any security settings and limitations of any sort? Both the opener and the opened window would be on the same domain. Has anybody run into troubles, bad experiences using it under certain circumstances? I'm asking because I'm planning to buil...

Preload a bunch of images from an array of file names, do function after 50% are done.

Hay, i'm using this script function preloader(images){ var i = 0; imageObj = new Image(); // start preloading for(i=0; i<=images.length; i++){ imageObj.src=images[i]; imageObj.onLoad = check(i, images.length / 2); }; } and passing a bunch of images into it to ...

What is the problem in this javascript code , getting "Operation aborted" in IE?

i'm getting dialogue box (Operation aborted) What is the problem in this code? <script type="text/javascript"> $(document).ready(function() { $('.demo').popupWindow({ centerScreen:'1' }); }); </script> ...