javascript

Facebook App, Ajax, and Internet Explorer

I have been playing around with facebook for the past few days and have written a simple app that asks the user a question about a random friend. I am using ajax to change the question and I though I had it working until I tried it in Internet Explorer. Please bare with my code since I am learning :-D This work perfect in Firefox and C...

(FInite State Machine) - Implementing a XML schema validator in javascript

Hello, I have been working on a project for a month or so now to develop a XML validator (XSD) in javascript. I have gotten really close but keep running into problems. The only thing I have working well is normalizing schema structures into FSA that I store in the DOM. I have tried several methods to validate my xml structures agains...

XML attributes to Array

Hello Everyone, I need to create a javascript array or object from an XML file that is structured as follows: <ITEMS> <TXT id="8" typ="1" pid="7" x="708" y="216" fcol="6777213" txt="sometext" hcmd="0" click="1"/> <TXT id="9" typ="1" pid="2" x="708" y="144" fcol="1231341" txt="some other text" hcmd="0" click="0"/> <GRAF id=...

Trouble inserting javascript to current webpage using C#

Lately, I have ran into the problem with not being able to inject javascript through a webbrowser contol without writing to a new html. Is there a way to inject a string of javascript to the currently browsed webpage? javascript:(function(){var s=document.createElement('script');s.setAttribute('src','file:///C:/abc.js');document.getEle...

Dynamically size a select list (Safari)

I would like to size a select list based on the width needed for the selected index(string). Say for example I have a list with 3 strings, short, medium, loooooong; I don't want the select list to automatically be as wide as its largest element, rather it should be as wide as its selected element. The first method I tried: document.getE...

setHours to 5pm

Ok, this might sound stupid and noob but right now in my js, I have this code: var date = new Date(); date.setHours(5, 00, 00); which will give me 5:00:00. Is there a way to set it to am/pm? ...

GWT returns null in foreign function interface.

I have a div <div id="aDiv"></div> When I try Window.alert(RootPanel.get("aDiv").toString()); I get the element however, just after the above statement, when I alert(document.getElementById("aDiv")); It returns a null. Can someone explain the discrepancies? ...

Javascript Clock output text style

I have a clock on my website written in javascript which I got from the internet and modified it slightly to fit my needs better and it looks great on firefox using a mac, but when I use it in other browsers on a PC or Mac it looks terrible and I have no idea how to change it, I'm fairly new to javascript. The code i'm using is below: ...

Can't see problem in JS

Hello, I want that when mouse is over an image, an event should be triggered ONCE, and it should be triggered again only after mouse is out of that image and back again, and also at least 2 seconds passed. If I leave my mouse over the image,it gets called like every milisecond,and by the logic of my function once you hover on the variab...

Detecting IE6 using Javascript/jQuery revisited

I need to detect IE6 in order to work around the lack of position:fixed. I've been using a simple regex: var isIE6 = /msie|MSIE 6/.test(navigator.userAgent); This works almost all the time, except for the user whose browser claims to be both IE6 and IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE...

How do I keep my cursor/caret from moving inside of an input text element?

I'm trying to build a form that works in a manner similar to the Google Search page, as well as Gmail and several other pages (including the this page - see the "Tags" input on the Ask Question page). As text is input, a list of options will appear, and the user can use up and down arrows to select the option they want. The problem I a...

javascript regex: matching a phone number

Hello, how do I match this phone number in Javascript? > str "(555) 555-3300" > str.match( '/\(555\) 555-3300/gi/' ) null > str.match( '/(555) 555-3300/gi/' ) null I bet someone can answer this in 2 seconds. Googling the problem didn't help me. Update Also tried without the quotes: str.match(/\(555\) 555-3300/gi/) SyntaxError: Unex...

jQuery Plugin On Event Return True/False

I'm creating a plugin that replaces alerts/confirms for a project and I was curious if there was a way to make it like a real confirm where you can do: if(confirm('Yes or no?')){alert('You agreed!');} Right now I could do with a call back using this syntax: $.alert('yes or no',{type:'confirm'}); But i want to be able to do: if($.a...

receive complex objects from javascript in flash

I'm trying to call a Flash function from javascript passing complex data types as arguments the Flash function is being called correctly but the args have no value, I mean they are both complex data types with propertiesbut in Flash when I try to access those properties I get "undefined" and yes, I'm sure the javascript code is correct a...

Javascript::How to identify what the character (or string) was inserted on a editable div?

I want to know how to identify what the character inserted on a div editable... I want to see if the user type a single or double quotation mark, and give a specific class to this quote to the text after the quote... I think that is a onkey property or return... i don't know... Anyone has a tip ? ...

jqGrid dynamic select fields

Hi, is there a way to modify the values of a status field in the colModel dynamically? Lets say we have a col Model with a field like: ... field ... name: "state",type: "select", editoptions: {value: "0:state0;1:state1;2:state2;3:state3;4:state4"} So I get a select field for my states with this values. But I need to dynamicaly decide...

Problems with 'this': How do I access both an element and a class inside an addEvent function?

This is probably best explained through some code. I know that in the following example, the this inside the addEvent method is the current element contained in the array elements. var testClass = new Class({ testMethod: function() { var elements = $$('.elements'); elements.addEvent('click', function() { ...

javascript - map one array to a second array with a negative index offset

Alright, I'm taking an array, and making another array from it with the only difference being the indexes are displaced by an arbitrary number determined using two reference points (one in each array). Doing this creates negative indexes, which if it didn't stop the script from working, would be useful. Is there any way to have the sec...

Using Ext.data.Store to pre-populate a simple Ext.FormPanel

Hi ExtJS developers. I am new to ExtJS and am trying to pre-populate a basic form with data read from an external XML resource. I can not seem to get the data pre-loaded, following is the code: Ext.onReady(function(){ // getting the UUID from what is passed on by REST Controller var myuuid = location.pathname; var myurl = ...

Cannot Pass All jQuery 1.4.2 Ajax Unit Tests With my Plug-in

I've created a plug-in that duck-punches the jQuery Ajax function. One problem that I cannot locate when running the Ajax unit tests for 1.4.2 It will not pass the two tests Ajax events with context jQuery.ajax context modification Test one has a test that always fails: function callback(msg){ return function(){ equals( this, ...