I'm moving some code from YUI to javascript and some of it is using YUI's YAHOO.util.Dom.getElementsBy(function). I've been reading through the prototype API docs and haven't been able to find something equivalent. It needs to be able to take an arbitrary function not just select off a CSS selector or the like. Can anyone suggest to me t...
Hi all,
I'm building an openid signature generator in javascript, and I have no experience working w/ octet strings, but step 3 of the signature gen procedure in the openid 2.0 spec states "Convert the list of key/value pairs to be signed to an octet string by encoding with Key-Value Form Encoding".
The string I've come up w/ (via Cr...
I want to create a Class, say MyDiv, which inherits from the original DOM DIV element.
Later in my code I would like to use it like that:
$('a-container').adopt(new MyDiv('my own set of params'));
I am missing the exact syntax to do it.
...
I has checkbox the list of media in my webpage
<input name="c1" type="checkbox" value=<%= item.MediaId %> />> mediaA
<input name="c1" type="checkbox" value=<%= item.MediaId %> />> mediaB
<input name="c1" type="checkbox" value=<%= item.MediaId %> />> mediaC
In my javascript,How can i keep the checkbox value inside the array for exam...
I'm using the geocoder from Google API v3 to display a map of a country. I get the recommended viewport for the country but when I want to fit the map to this viewport, it does not work (see the bounds before and after calling the fitBounds function in the code below).
What am I doing wrong?
How can I set the viewport of my map to resu...
I'm working on an ASP.NET web app where I'm using a Wizard to take the client through a large series of steps.
One of the steps includes calculating a bunch of numbers on the fly... the numbers calculate properly but when I click "next" and then go back again... some of the numbers are not retained.
Here is the calculation function
fu...
I am using javascript (and PHP) to validate a simple form with a phone number field. I have it working fine checking that the field has only 10 characters, but I really want to check if the field has between 10 and 11 characters.
Reason being, some people type numbers like so: 1 555 555 5555 and some people do this 555 555 5555.
He...
$code = $_POST['code'];
echo "<script language='javascript'>
document.getElementById('code').value = $code </script>";
I tried '$code', "$code","..." + "%code + "...", and i cant change the textfield's value to the PHP value.
Mmm!!!
...
A web page of a web application was showing a strange error. I regressively removed all the HTML/CSS/JS code and arrived to the basic and simple code below.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>test</title>
<script type="text/javascript">
...
I've found some ideas, such as http://www.dustindiaz.com/element-scroll-into-view/, but I need a Mozilla/Chrome compatible solution that's not using any frameworks (YUI, jQuery, Prototype, etc.)
In short I need to convert this YUI code to non-YUI code:
var Event = YAHOO.util.Event;
var Dom = YAHOO.util.Dom;
Event.on(window, 'load', fun...
I'm having trouble getting a Java Applet to communicate with the Javascript code on the page the applet is hosted on. It works sometimes, but othertimes it throws an obscure exception, that googling for has not turned up any useful information, besides a few Java bug reports that were never resolved (thanks Sun).
Here is the code I am u...
Which one is the best XMPP client library for PHP/javascript?
I have gone through many of these like:
JSJaC
XMPPHP
MISSUS
Kaazing Gateway
Some one having experience in using these will have better idea.
...
Hi,
I can see how to attach an event to an object that has no parameters and no return value but how to modify the code below to attach a listener that takes parameters and returns a value?
function attachEventListener(target, eventType, functionRef,
capture)
{
if (typeof target.addEventListener != "undefined")
{
...
I've found many definitions of the 'var' statement but most of them are incomplete (usually from introductory guides/tutorials). Should I use 'var' if the variable & scope has been declared in the params list?
someFunc = function(someVar)
{
// Is it considered good practice to use 'var', even if it is redundant?
var someVar = ch...
I need to set the value of a field in a form via JavaScript. The source of the data is from another source, via an IFRAME. I'm running this code in the onload of the ASPX page in the IFRAME:
// Get value from source
var currencyText = document.getElementById("contractValue").value;
// Convert that value to a number, stripping out non-...
I need to dynamically create Dijits to add N rules to a particular form. Currently I am adding them with the following javascript.
var value = new dijit.form.Select({
id: "value_" + counter,
store: ValueStore,
searchAttr: "description"
},
"stateSelect" + counter);
value.placeAt(form, "last");
value.startup();
This ...
Ive been trying to target iframe using Raphael JS
heres some sample code
var c = paper.circle(10, 10, 10);
c.attr({href: "http://google.com/", target: "top"});
v
var t = paper.text(250, 50, "Raphaël\nkicks\nbutt!");
t.attr({href: "http://google.com/", target: "_blank"});
Also..cant get href to work with text
ar t = paper.text(50, 50,...
I have a YUI menu on the bottom navigation of the screen which creates a large white space beneath it where the action list would be rendered if visible...
On the first click the menu will render in that white space which requires the user to scroll to see it... on the second click however it will draw upward (ideally) so that the user ...
I'm using the following regexp to validate numbers in my javascript file:
var valid = (val.match(/^\d+$/));
It works fine for whole numbers like 100, 200, etc, however for things like 1.44, 4.11, etc, it returns false. How can I change it so numbers with a decimal are also accepted?
...
I have three selection drop downs in a form comprising of day, month, year. Pretty standard. Ive omitted all the individual select options for the purposes of this question.
<label for="start_date">Start Date<font class="required">*</font>:</label>
<select name="place_booking[day_val]">
<select name="place_booking[month_val]">
<select ...