javascript

Know If a user has visited your site from a Blackberry

I found this piece of code that can detect if a user has already visited your web page by injecting a hidden link into the DOM and checking if the color of it is the same as the one for visited links. function hasLinkBeenVisited(url) { var link = document.createElement('a'); link.href = url; document....

javascript problem in firefox

hi. i'm using this javascript to toggle the visibility of some divs which have different ids. it works how i want in google chrome and even in internet explorer but in firefox when i hover the links the divs won't change their visibility. javascript: function loaded() { // this one is called in the body tag about.style.visibi...

List of an element's events

Is there a way to find all of the events for a element in javascript? or a way to unbind all events from a element? Thanks. ...

javascript/jquery scope has me stumped

I have wrapped a common ajax call into a function. It pings a script, returns JSON. However for the life of me I can't seem to be able to have the JSON object be the return value of the function. Must be something fairly simple I am missing, bu for the life of me can't work it out. function queryCostCenter(user_id, currency_id, countr...

Why can't I have a direct reference to document.createElement?

When creating lots of DOM elements, document.createElement and friends can add lots of bytes and ugliness. I know I could make my own subroutine, or use innerHTML or whatever, but why can't I just do this: var $c = document.createElement; var newP = $c('p'); Firebug complains with this message: "Illegal operation on WrappedNative pro...

Good scripting language/framework for recreating polynomial root calculator

I was just wondering what the best online scripting language is to use for "simple" mathematical calculations, like solving for roots in 2nd 3rd or 4th degree polynomials. For example, creating a little web "applet" like the one found here which inserts the values inputed into the text boxes and inputs them as variables into the "quadra...

Obfuscated javascript code with binary values?

This code outputs D. The question is HOW? alert([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![...

Problem mixing overflow-x, FireFox, and Javascript.

First of all, this problem only happens in Firefox. Check this example page to understand the problem: -removed- Select any page besides home. The window will scroll to page. You can then scroll down using the mouse wheel. This works fine. BUT if you grab the scroll bar on the right with your mouse it will jump back to the "home page" ...

Looking at the source of a dynamic dropdown applet or database?

So I'm looking at http://ohiostate.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?storeId=33552&catalogId=10001 and was wondering if there was a way I could get all of the possible classes/options for the courses in a semester. There's a class locator on the top left of the page, and it has a dynamic drop down menu. Is there an...

JavaScript clear text box input not functioning properly

I know that this is an embarassingly easy question, but I can't figure out the problem, and that's why I'm asking the question, so please don't reiterate this point. Anyway, I'm just working on something here, and when I tested my page to see how things were going, I realized that my calculate() method isn't clearing text input like I w...

highlighting variable date in a table

Good morning, I am having trouble with the following code <html> <head> <title>highlight date</title> <style> .row { background-color: Yellow; color:blue; } </style> <script type="text/javascript"> </script> <script src="jquery-1.3.2.min.js" type="text/javascript"></script> <script language="javascript"> var currentTime = new Date()...

Guidance for retrieving number of page views using Google Analytics API

An answer of the question Best grails implementation for tracking number of views (or unique visitors) for a web page ? was to use Google Analytics API for tracking and displaying the number of page views for some particular page on my website. I liked the idea and had a look of the Google Analytics API but, at first view, it seems to ...

Error removing child element

Hello, I have a bunch of input boxes and a button at the last input box to add more input boxes which. I have a problem removing the button when the add button is clicked. http://gist.github.com/621417 I am getting this error on trying to removing a child element. Error: uncaught exception: [Exception... "Component returned failure co...

onclick multiple javascript functions

Is there any way to use the onClick html attribute to call more than one JavaScript method? EDIT: Thanks for all of the answers guys! :) ...

adding a button in the edit menu of a webpart in sharepoint 2010

Is there a way to add a link or button in the menu that appears when you click on the top left corner of a web part in sharepoint 2010? ...

Fetching remote code/text with javascript?

So I'm working on making a dynamic drop down select form and I need for each menu to propagate possible choices from a prebuilt chunk of html (located at, say, http://example.com/menu/choices) is there an easy way to use javascript to fetch the html of a remote page and then plug that in to the page? I know I can use .write() to insert t...

replace a text with another within a tag

I'm sure it's stupidly easy, but how can I replace just the text within an html tag. For instance, from this: <div style="display: block;">blah blah</div> <a href="#" style="display: inline; ">(Old text)</a> to this: <div style="display: block;">blah blah</div> <a href="#" style="display: inline; ">(New text)</a> replace Old text =...

How do I prevent javascript returned from an ajax request from executing when the response is inserted into the DOM?

So, I see so many people wondering how to execute JS code returned via ajax. I wish I had that problem. My JS executes, but I don't want it too! Using jQuery 1.4.2, I'm making a GET request: $.ajax({ url:'/myurl/', type:'GET', success:function(response){ $('body').html(response); } }); The response looks something like: ...

javascript function not calling possibly due to scope issue

I am looking to call my clear() JS function to clear the text values in some input fields on my webpage, but for some reason, the function doesn't appear to be called correctly. I believe this may be a scope issue, but I'm not sure. Here is my markup, script and styling kept together for ease-of-use currently, but will be mended once s...

How to pass an onclick link value to javascript and cfc though cfajaxproxy?

How do I pass an onclick value <CFOUTPUT QUERY="questions"><A HREF="javascript;()" onClick="VoteNo('#ID#');" ID="VotedNo">I Vote No</A></CFOUTPUT> in to javascript so that the script can be used multiple times for different questions? I am also using cfajaxproxy with the javascript so that ID value also needs to be passed on to the CFC s...