javascript

Combine accordion drop down with scrolltop behavior

I am using jquery to do two things. First, I have an accordion box (created using .slideToggle) that slides down when the user clicks a link. Second, I have a link that the user can click, which will scroll the window down (using .scrollTop) to reveal some content on the bottom of the page. I would like to combine these two functions s...

ul with links remains selected

Hi! I have a side bar menu composed of ul->li->a, styled with css to look as a vertical menu on the left side. I just noticed that when I choose an option a thin grew dotted line surrounds the box(button of the menu) that I selected. To me this looks "wrong", is there a way to prevent this from being visible? Thanks! ...

Creating an Interactive bar Chart out of Google Analytics Data

Hi Guys, I want to make a bar chart from the google analytics data. Current implemetation of the bar chart in my site is by See Analytics I am developing an ASP.NET website and this See Analytics is using PHP and jQuery to conjure the chart. It is also paid. What my client would like is a similar tool that draws chart from analytics,...

how can i add a function to json object which has __type attribute?

I am sending an object that i generated within a class from the server as a result of web service call. it is returning with __type and it's other attributes from server. I want to add some function to this object to call from everywhere easly in my files. How can i achieve this? Thanks... ...

Images don't load while javascript while loop runs.

Hi, I'm writing an image pre-loader for my html5 project and I've struck a problem. Images that are used in the game are defined with the image object within JavaScript like so: images = new Array(); images[0] = new Image(); images[0].src = '/images/tiles/grass.png'; As soon as "document.ready" the pre-loader function as seen below i...

Practical use cases for returning javascript from an XHR/Ajax request?

I've never really had to return javascript from an XHR request. In the times I've needed to apply behaviour to dynamically loaded content I could always do it within my script making the call. Could someone provide actual real world cases just so I'm aware, of when you'd actually need to do this ( not for convenience ), or some reasons ...

.slideToggle auto scroll down to reveal content

I am using .slideToggle to open a panel when the user clicks a link: <script type="text/javascript"> $(document).ready(function(){ $(".btn-slide").click(function(){ $("#panel").slideToggle("slow"); $(this).toggleClass("active"); return false; }); }); </script> The content of the toggled div (#panel) is taller than the height of th...

Internet Explorer Javascript Image Problem

I following the book "DOM Scripting" by Jeremy Keith and I have hit a wall in trying to get a small image gallery to render correctly in Internet Explorer 6/7. I have 4 thumbnails which load in a placeholder when clicked using the following code: function showPic(whichpic) { if (!document.getElementById("placeholder")) return true;...

how can I sync JS timeout and ASP.NET session timeout?

Ok. I can't really solve what I want - so if you can please advise me on how to: I have a page of each every click has ajax call to my server (hence, the ASP extends the session) I have ASP.NET session set to Xmin. I want when X+1 min expires, I have expiration page. what I did was to set the JS timer to validate every x+1min to see if...

Full Screen Google Map

How can I use Google Maps API to show me a full screen map with no sidebars or search bar? I just need it to show a specific location in a mobile app, users don't need to search. Is this possible? Also if I provide a street address how can it put a push-pin at the location? ...

Getting Invalid at the top level of the document. Error processing resource 'http://localhost:8080/AjaxDecoder/response'. Line 1, ...

Getting the following error when loading the URL in the browser: The XML page cannot be displayed Invalid at the top level of the document. Error processing resource 'http://localhost:8080/AjaxDecoder/response'. Line 1, ... Using Eclipse with Tomcat integrated. My web.xml file is: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, I...

What's the fastest way to merge Array's in JavaScript where comparisons are expensive?

I want to merge two Array's in JavaScript. Unfortunately, comparisons of the particular data I am using is expensive. What is the best algorithm to merge my to lists with the least amount of comparisons? EDIT: I should note that the two Array's are sorted and I would like the merged content to be sorted and have only unique values. EDI...

How to disable refresh button once user goes on a particular web page ?

Hi I have to create a web page for a online quiz which will display same questions in different sequence for each user. Now, I have written code which takes questions randomly every time when user visit that page. User goes to that page by login id and password. I have used random function in query which gives questions in different o...

event contex for live function in jquery

HI , I am using JQuery 1.3 , i am facing problem in using live event as in jqyery . DOM element "context" is bound to default document root. so how to overcome such thing ? Note : As of jQuery 1.4, live events can be bound to a DOM element "context" rather than to the default document root. To set this context, we use the j...

Java to JavaScript Compiler

Besides GWT out there, are there other Java to JavaScript Compiler. Currently all my work is done in Java and I heard of Java2Script too. Anyone out there knows other Java to JavaScript? ...

Why the open quote and bracket for eval('(' + jsonString+ ')') when parsing json string

Can you please tell me the reason for this specific syntax structure eval('(' + jsonString+ ')') When parsing json text. Crockford says "The text must be wrapped in parens to avoid tripping on an ambiguity in JavaScript's syntax." here. What does that mean? Can we avoid it? ...

Using JScript in powershell

Reading through the documentation for powershells add-type it seems you can add JScript code to you powershell session. Firstly is there a decent example of how this is done and secondly can you use this to validate normal javascript code (as I understand JScript is the MS implementation) ...

Dyanamic Graphs using jsf.....

My requirement is I need to populate dyanamic graphs in a jsp page. I am using jsf for my project. I planning to use "jfreecharts" but dont know how to bind my jsp page with the back bean. I have some drop downs on the basis of the selection I my BackBean is fetching the data from the DB. Can you please suggest me some procedure to that ...

css body background image clickable

I need to place an advertisement as a background image of my webpage. What's the best way to make the body background image a clickable link? ...

Finding number selection possibilities

I have the following example data in javascript: var variations = [ {group: 1, id: 1}, {group: 1, id: 2}, {group: 1, id: 3}, {group: 1, id: 4}, {group: 2, id: 5}, {group: 2, id: 6}, {group: 2, id: 7}, {group: 3, id: 8}, {group: 3, id: 9} ]; Let us say I already define the selection using the following variables: var...