javascript

How to make javascript/jquery code error proof ?

If jQuery is included in <head> and in <head> if we have some another jQuery code and that code has an id which is a id of an HTML element, so if jQuery library and jquery code in <head> is added globally And if any page doesn't have that html element which is used by jQuery code then browser gives JavaScript error. Can I make jQuery/J...

Gradient-filled contentEditable text in HTML

Can I have such effect in HTML without using an image? The text should be editable with this effect. ...

Problem using loop values in function

Hello - Beginners Javascript question here. I am trying to create a function that finds all the links in a given div and sets up an onclick event for each one. I can get the link hrefs correctly, but when I try using them in the onclick function, Javascript seems to only use the last value found: I.E I have these links #purpose #futu...

Does anybody know is this GTrack good plugin?

Hi Guys, Have anybody know any jQuery plugin that able to do event tracking using Google Analytics? I found a good one in this link. It called GTrack. I am thinking whether to use or not... Do you know any similar plugin does this? Thanks, Rob ...

Inject javascript into a javascript function

Hi all, I've got a weird question in that I need to inject some javascript into another javascript function. I am using a framework which is locked so I can not change the existing function. What I've got is something like this function doSomething(){ ... } ...* I can manipulate the *(above) however I can not change the doSom...

how to determine which JavaScript events are being triggered

As the title says, how can I find what JavaScript events are being triggered as I interact with a webpage? ...

CSS relative positioning

I am developing a web page with dynamic dimensions i.e I first read the size of the canvas and adjust my elements widths and heights accordingly. if(!window.JSFX) JSFX=new Object(); if(!JSFX.Browser) JSFX.Browser = new Object(); if(navigator.appName.indexOf("Netscape") != -1) { JSFX.Browser.getCanvasWidth = function() {ret...

default load of a single location

Hello, I want to load always a single location in google-maps using javascript and html. thanks v.srinath ...

Open window in JavaScript with HTML inserted

How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file? ...

How to send JSON requests to a remote server ?

I'd like to send a JSON rpc to a remote web-server. The client-side of my application must be completely javascript. The choice of the client library should be independant from the json-rpc implementation on the server-side. I don't need json-over-http. Simple json objects over tcp/ip is enough for my use-case. Thanks ...

What kind of algorithm does an HTML SELECT element uses to show results as you type?

I'm trying to replicate an HTML SELECT element (drop-down-list or combobox) in Flash (AS3). In most browsers, when you have one in focus and you type something, the combobox will try to find the value within its options and show the closest one. I was wondering what kind of algorithm is used for that. I don't think its Levenshtein or si...

Generating a JavaScript array from a PHP array

Suppose that I have a string $var: //php code $var = "hello,world,test"; $exp = explode(",",$var); Now I get the array as exp[0],exp[1],exp[1] as 'hello', 'world' and 'test', respectively. I want to use this all value in javascript in this: var name = ['hello','world','test']; How can I generate that JavaScript in PHP? ...

How to get Pagination plugin class names dynamically?

Hi there, I am trying to get the class names dynamically for the script below. I am using the Pagination plugin. I have different class names that are created through PHP so need to get them using jQuery dynamically. As you can see below, there are two '#hiddenresult div.result'. 'result' is the static class name that needs to change s...

Any way to run Firefox with GreaseMonkey scripts without a GUI/X session

I need to build a small "monitoring" scraper for a 3rd party website (it's an external website that has stats about our visitors). Unfortunately, this website is very hard to scrape through the normal "wget" mechanism, because it uses a ton of sophisticated JS, part of it generated by GWT. So my workaround was to create a GreaseMonkey s...

How to make a fullscreen iframe with opaque background?

I am able to create an iframe which occupies entire screen. But I am not able to make the contents of the background hidden, In other words, I want an iframe which is opaque. I am currently trying like this: <iframe name='myifrmae' allowtransparency = 'false' background= '#FFFFFF' id = 'myiframe' src = 'main.html' style='position:abs...

jQuery LiveSearch - using table instead of list

I'm currently trying to use the jQuery Livesearch plugin (http://ejohn.org/blog/jquery-livesearch/) to use a table instead of an unordered list. I also want my search results to be shown based on the title attribute of the table row rather than the innerHTML of the table cell. This is my HTML: <div id="wrapper"> <form method="get...

Using javascript regexp to find the first AND longest match

I have a RegExp like the following simplified example: var exp = /he|hell/; When I run it on a string it will give me the first match, fx: var str = "hello world"; var match = exp.exec(str); // match contains ["he"]; I want the first and longest possible match, and by that i mean sorted by index, then length. Since the expression ...

a strange $.get()

Hello everyone, I have this code, a simple jQuery GET: $.get(url, params, function(){ function_call() }) I wonder why the function_call() is never executed. The server at url is up and running and changing the function to $.ajax() shows no errors (the error option is not executed), but it's not working. Any clue? param...

Best Server Side Application for accepting website statistics

I been thinking about how to configure a web statistics to collect information like Google Analytics. I would think that sending the info over would have to be super quick. My initial thought would be to use http://activemq.apache.org/ to receive the information (Quicker than a DB insert) and then a separate process would actually take...

Dynamically loading a JavaScript file is different if I use appendChild() or jQuery.append()

I am trying to dynamically load a JavaScript file by adding a script element to the head element, after which I test for the presence of a function defined inside that file to check that the load succeeded. If I use this code: var scriptElem = document.createElement("script"); scriptElem.type = "text/javascript"; scriptElem.src = 'myfi...