javascript

How to access javascript value in a4j

Hi there. I need to set a Bean value with one javascript return value. Something like: <script type="text/javascript"> function getUserId(){ return 4; } </script> <h:inputText name="lala" value="getUserId()"/> Thanks ...

A simple If...else block. Why is it doing nothing?

<html> <head></head> <body> <script type = "text/javascript"> var x = 5; var y = 8; if (x < 6) { document.write("They are equal"); } else { document.write{"They are NOT equal"); } </script> </body> </html> ...

Is it possible to use javascript to download JSON object from another domain/server?

What would that code look like? ...

How to use javascript or jQuery to quickly select a preset of multi-select listbox items?

So say my page has a list of indexes '1,3,4,5,9,12' and a multi-select listbox with 12 items in it. What's a fast way to use javascript to tell the listbox to multi-select all items at those indexes? How would this be done using jQuery? So for example if the user selects the 'caramel' preset associated with the 'candybar' listbox, it ...

good php framework for fully ajax-based web applications?

i'm developing a web application that focus heavily on ajax. the whole application is just on one page except for the threads that are in traditional pages so they can be indexed. so i have to have very structured JS-codes and i wonder if they are any frameworks out there that are for ajax-based applications. eg. codeigniter, cakephp a...

How would MVC-like code work in Node.js?

I'm starting to get my head around node.js, and I'm trying to figure out how I would do normal MVC stuff. For example, here's a Django view that pulls two sets of records from the database, and sends them to be rendered in a template. def view(request): things1 = ThingsOne.objects.all() things2 = ThingsTwo.objects.all() ren...

Fill list up to 10 items

I'm looking for a way to fill a <ul> list up to 10 item. If the list doesn't have 10 in the HTML, I want the items to repeat themselves. For example: <ul id="carousel"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> </ul> I tried to do it myself, but it's not exactl...

JSON and Backslash

Can anyone shed any light as to why my JSON is coming out below, with the extra backslashes. I am using ASP.net MVC to serialise a datatable, when I debug in Visual studio it all looks ok but when I look with firebug with adds the extra characters? Any ideas anyone? "[{\"uid\":\"516219026\",\"pic\":\"http://profile.ak.net/\",\"first_na...

WinForms WebBrowser control — Get Document Elements After AJAX?

I'm using WebControl from Windows Forms in C# and I'm trying to load a Web Ajax content (i suposed that the content is ajax) this is the code of the page retrieve from the explorer: <ul id="building"> <li id="button1" class="on"> <div class="supply1"> <div class="buildingimg"> <a class="fastBuild tips" title="|Expandir...

How to use an array value from php to javascript?

it was always a question for me that how can i use an array value in javascript while that array is defined in my php scripts For example consider reading some values from a file and use it in javascript. what's ur plan to do so ? ...

Javascript Validation not working on .Net Content Pages...

I'm wondering if anyone else has experienced the following issue. On a single non-linked (to a master page) .aspx page, I'm performing simple JS validations: function validateMaxTrans(sender, args) { // requires at least one digit, numeric only characters var error = true; var regexp = new RegExp("^[0-9]{1,40...

Cross domain and google CDN for jquery

Doesn't using Google CDN for jquery break the rule of not using cross domain requests on the webpage. Do we trust Google enough to do this? ...

Feedback tab like www.monyta.com

I am interested in adding a stick feedback tab to be hosted on my page. No third party ones like uservoice, monyta, getsatifaction.. etc. It should be sticky while scrolling vertically and the tab should slide out showing a form to be filled out and submitted, very much like monyta. Any JQuery plugins (or plain Javascript) which do thi...

Is automatically assigning focus bad for accessibility?

If I have a form that is the main part of a page's content, will assigning focus to the first form field via JavaScript on page load have any negative effects on accessibility? ...

What is the best way to communicate between JavaScript and Actionscript 2.0 and 3.0

What about support for major browser? IE 6+. FF 2+, Opera 9+, Safari 3+, Google Chrome? It is good idea to use actionscript to generate graphics (interface developed in JS and standard HTML forms)? Maybe its better to use canvas? What about performance? ...

Handling self-refreshing pages from selenium

I have been running into intermittent errors with some java selenium-rc tests which I think are related to a page which has an ajax poll and automatically refreshes when some condition is reached on the server. In this scenario, I have no way of asking selenium to wait for the page to load, and so I run into a bunch of random "Couldn't a...

Img tag works when hard coded but not when dynamically inserted via javascript.

If I dynamically generate the img tags they don't show up when they should, but if I hard code the values in there the images show up. Anyone know why this is? According to my jQuery there should be 2 image tags inserted after each input with the class .inputBox HTML: <form action="" method="post" id="myform"> <label for="FirstName...

Cross-platform JS access to local filesystem via plugin?

I have a javascript photo-organizer built on the YUI JS libs which can organize photos from many sites via REST api. I want to know if I can resuse any of this code to organize photos on the local filesystem. I need a cross-browser (i.e. PC/Mac) solution to the following (in order of increasing privilege): persistent file access to...

hoverIntent Accordion menu and open close boxes not working together in ie8 jquery

i have a site where i am using an accordion menu plugin and hoverIntent. this is the code for the accordion: (function($) { $.fn.hoverAccordionMenu=function(options){ var hoverIntentConfig = { sensitivity: 3, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number =...

Web UI for inputting a function from the reals to the reals, such as a probability distribution.

I would like a web interface for a user to describe a one-dimensional real-valued function. I'm imagining the user being presented with a blank pair of axes and they can click anywhere to create points that are thick and draggable. Double-clicking a point, let's say, makes it disappear. The actual function should be shown in real time...