javascript

Get entire text of document as a string using javascript

I am developing a firefox extension and ideally would be able to get the whole darn DOM as a string.. forget any data structure. I just want what I see in "view source" in a buffer. I have been checking out javascript references and HTMLDocument etc. with no avail. Ideally I would be able to write to this buffer as well (seems possible...

best way to ajax load-in external javascript files with jquery?

I have a one page web application, which means alot of javascript. External scripts like facebook connect etc most visitors wont use, so i'd like to know the BEST method of loading js files on an event (click, hover, timer etc). Idealy with jquery. ...

change the style of menu, if it is selected, without php

how can i change the style of menu, if it is selected, without php? i can do it by php `<? if($_GET[id] == "this_menu") echo "style='color:red'"?>` but i want to do it without php. is it possible? thanks ...

how to clear the 'double right click ' on google-map-v3..

this is my code, and I can't remove the mousedown eventlistener : //*********** double right click ********/ var c =0 ; function time(event){ if(event.button == 2){ c++; setTimeout(cc, 600); } if (c >1){ alert('ok i get it') } } //$('#map_canvas')[0].mousedown(time); $('#map_canvas')[0].addEventListener('mousedown...

What is the point to put deadlock code ahead of JSON in HTTP response?

When sniffing Gmail and Facebook traffic, I found there are leading deadlock code before JSON response of XmlHttpRequest. For example for (;;);{"t":"continue"} and while(1); [["v","nW3OxUDq0kU.en.","8","51bec53f21305d9c"],["di",86]] What is the purpose of this "for(;;);" and "while(1);" deadlock? ...

Updating the value of a math equation with YUI slider and simple radio buttons.

I have a form that is used to show a price for a product. I have a YUI slider setup that changes the price, and it works perfectly. Now I'm trying to add in radio buttons that also should update that same price value. The price displayed should take into account all 3 fields, and update dynamically as any are updated. This is the code I ...

What type of data is this JavaScript code!?

Hello, Well, I'm completely new to JavaScript. Can you please tell me what type of data is this JavaScript code: var options = { sourceLanguage: 'en', destinationLanguage: ['hi', 'bn', 'fa', 'gu', 'kn', 'ml', 'mr', 'ne', 'pa', 'ta','te','ur'], shortcutKey: 'ctrl+g', transliterationEnabled: true }; I've reviewed JavaSc...

Can I create a variable with JavaScript that PHP can recognize?

I have a series of PHP statements that I only want to run if javaScript is enabled. if($js_enabled == 'yes') { //Run a series of PHP statements } My problem is that I want to create that $js_enabled variable with javaScript. Therefore, if javaScript is enabled, the variable will be created and the PHP statements will be run, but if...

Using a bookmarklet to track a package

I'm trying to write a bookmarklet that tracks a package in the mail. First it checks to see if the tracking page is open, if not it opens it in a new tab, and then sets the value of the form to the tracking number. Finally, it submits the form. What I'm so far unable to do is set the value of the form in the case where the bookmarklet...

Multiple dropdowns, combination check and filter

Using Javascript / jQuery, I'm trying to build a "combination checker" that will take the values of three (but can be more) dropdown lists and filter the options based on a supplied list of allowed combinations. For example: DROPDOWNS Field 1: - value_1 - value_2 Field 2: - value_3 Field 3: - value_4 - value_5 COMBINATIONS - value_1...

getElementByClass().setAttribute doesn't work

why when i write document.getElementByClass('home1').setAttribute('style', 'background-image:url(img/red_menu.PNG);'); it doesn't work? i have the element with class="home1" with document.getElementById('home1')... works fine thanks ...

Cyrillic characters from javascript cookie to php output via $_COOKIE

When i'm trying to put russian text in cookie via javascript and then output it via php it returns: %u043F%u0440%u043E%u0432%u0435%u0440%u043A%u0430 How to decode this to normal cyrillic characters? This is the function i'm using to pass to document.cookie: function setCookie(c_name,val,c_expiredays,c_path,c_domain,c_secure) { v...

Js (+Mootools) - Why my script use over 60% of processor?

On this site - LINK - i need to use 3 banner scrollers (2x vertical + 1x horizontal). I've tried to do it in flash, but then everyone web browsers shut down, or suspended. Now i want to do it in JS (i use mootools). All data come from MySQL. Here's the complete code (even if you don't know mootools, You should understand it) global $wpd...

Could Future Security Measures Limit JSONP's Cross-Domain Asynchronous Capabilities?

Is there a risk that future revisions of the Same Origin Policy or other browser security measures could prevent the cross-domain asynchronous request capability of JSONP? This would have to be taken into consideration if a developer intends to provide asynchronous capabilities in a public environment. ...

dojo.io.iframe erroring when uploading a file

Hi, Hit an interesting problem today when trying to upload an image file < 2MB using dojo.io.iframe. My function to process the form is called, but before the form is posted to the server I am getting the following error: TypeError: ifd.getElementsByTagName("textarea")[0] is undefined My function that is used to action the post of ...

Wire the homepage so that it fires off a Push notification message to my iPhone every time someone lands on the page

I looking for a simple way to wire the homepage of my website so that it fires off a Push notification message to my iPhone every time someone lands on the page (just visiting in their browser). I'm aware this could become annoying! I currently send regular notifications to my iPhone using cron and curl to check sites / RSS feeds for ch...

ZK: Problem with JavaScript method invoking from action in Google Chrome

I have a zul file with description of simple window, which contains button with action : <?xml version="1.0" encoding="UTF-8"?> <zk xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.zkoss.org/2005/zul" xmlns:zk="http://www.zkoss.org/2005/zk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocati...

How to convert Date format

Hi All, I have "Friday, April 02, 2010" as date now I want to display "04/02/2010" if browser language is selected english and "02.04.2010" if browser language is selected as German. All I want, is to display the date as per the browser format. Any Idea how this can be done? ...

Is there a nice javascript dialog box for JQuery that works with mobile?

Mobile browsers. Jquery dialog alert box. I don't want to use alert() because it looks ugly in web browsers. I'm building a website for BOTH mobile and web, so I need a dialog box that can work on both. ...

Getting value from key pair value into appended property using jQuery

How do I get the value from a key pair value into the rel property of an anchor tag? When I split the code to put the value in the correct place it doesn't work, the end of the a tag would appear on screen instead value wouldn't be applied. When I look at the resulting code in console in Firebug the rel and href swapped order so the rel...