javascript

HTTP POST in javascript in Firefox Extension

Hi there, I'm a newbie trying to do a simple HTTP post in JS within a Firefox extension.. This isn't passing through the parameters: var params = "a=1&b=2&c=3" req.open('POST', 'http://www.mywebsite.com/'); req.send(params); Any ideas on what I'm doing wrong? Thanks. ...

Chaining a function in JavaScript?

I want to make a function that add an item to my localStorage object. E.g.: alert(localStorage.getItem('names').addItem('Bill').getItem('names')); The first method is getItem which gets the item for localStorage objects... but addItem would be a custom function. This chain of functions would finally alert Bill. So, how would I make t...

Relative Positioning at bottom of the screen issue with Flex and different browsers

I have a flex component like this: <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" ... width="100%" height="100%" creationComplete="init()"> ....... <components:NavigationBar id="nagivationBar" left="0" bottom="0" /> This is supp...

subdomain name validation in javascript/jquery

I have a signup form where users kan enter their subdomain of choice when creating an account. http://_________.ourapp.com I want them to be able to enter valid characters on the __________ part above only. I'm using a text field for that. Is there a function or some sort of pattern that exists for such situations? Spaces should be f...

Way to get element user is currently typing in within designMode iframe?

I have an iframe with designMode set to 'on'. In it, there are multiple divs, and because the iframe is editable, the user is able to type in and edit any one of those divs. I need to disable the ability for the user to edit one of the divs. I can prevent the user from clicking on the div like this: document.getElementById('mydiv').add...

Javascript failing in Firefox/Firebug?

I'm using Firebug to develop a JS app. All of a sudden, when I got to the page, it appears that I do not have JS enabled - the <noscript> warnings are rendered, and nothing works. When I go to the same page in Chrome, everything works fine. What could be happening? I reverted recent changes back to a point where it worked, but it's stil...

Can anyone tell me why my alert(id) isn't firing off? Nada, zilch, zippo.

First of all let me say thank you to everyone that offered answers...I have definitely advanced and even on my local machine everything is working perfectly. However it's not working on the server. I tried a bunch of things such as putting session_start() into the included files but nothing has taken. Rather than post the code here I'v...

Is there a good Javascript based HTML parsing library available?

My goal is to take HTML entered by an end user, remove certain unsafe tags like <script>, and add it to the document. Does anybody know of a good Javascript library to sanitize html? I searched around and found a few online, including John Resig's HTML parser, Erik Arvidsson's simple html parser, and Google's Caja Sanitizer, but I haven...

jQuery pass dynamic element id/value into PHP.

Hi, I want to pass the dynamicLi element id and text into the PHP which look like this. <ul id ='dynamicUL'> <li id='dynamicLi'><div id="fieldname">Field 1</div></li> <li id='dynamicLi'><div id="fieldname">Field 2</div></li> <li id='dynamicLi'><div id="fieldname">Field 3</div></li> </ul> The dynamicLi and the fieldname is ...

JavaScript TagCloud Avoid Overlapping

I’m creating a tag cloud using JavaScript. It takes an unordered list of 'tags', and then distributes them randomly from the centermost-point of the div (Gaussian distribution). The trouble I'm having is finding an efficient metric to determine if any of my tags are overlapping. Ultimately I came up with 2 approaches: (1) position eac...

Storing HTML into a javascript variable

I'm having some trouble with some javascript. I'm using jQuery to dynamiclly add rows to a table. Additionally the javascript is being generated from some PHP and Kohana code. Here is the script. <script type="text/javascript"> function delExtensionNumber(element){ $(element).prev().attr('value', 'X'); $(eleme...

Is it possible to use `event.preventDefault()` with a `select` element with jQuery?

I have dropdowns which are dependent on other dropdowns. I decided to calculate the dependencies on click, except it has a nasty side effect of showing option elements, then they quickly disappear and the dropdown list resizes. I wondered if I could use event.preventDefault() on click, and then call the click() event manually after I h...

jQuery - How can I wrap() all elements in one container rather than each element?

I have HTML similar to the following: <fieldset> <legend>Title</legend> <p>blahblahblah</p> <p>blahblahblah</p> <p>blahblahblah</p> </fieldset> What I want to do is wrap all the P's into a single container like so: <fieldset> <legend>Title</legend> <div class="container"> <p>blahblahblah</p> <p>blahbla...

When creating a native JSON array how to limit it to 10 most recent

I am creating a JSON array exactly as follows (bar using mathrandom). For example purposes: var numbers = []; var jsonString = ""; function EveryOneSec() { numbers.push(Math.random()); jsonString = JSON.stringify({'numbers': numbers}); setTimeout(EveryOneSec, 1000); } When I create the JSON string it will obviously just keep g...

Nodes and Elements in the DOM

Why are Element objects a subclass of Node objects? Aren't elements and nodes the same thing, with different names? Or are there other kinds of Node? ...

clear specific fields when user changes value of a select

Ok, I'm really starting to have a bad day and the ol' brain isn't working. I can't think of what I should be searching for, or even find previous examples of this kind of thing. I have a HTML form with three fields; select: disposition_status text: disposition_datetime_hasrecord text: disposition_description The select field disposi...

trying to wite js makes whole page go blank

hi, thanks for looking, when i use document.write, the whole pages goes blank and only displays the ad. function __adthis(id) { $.getJSON('banner.php', function (data) { var adNum = Math.floor(Math.random() * data.ban.length); document.write("<SCRIPT TYPE='text/javascript'> SRC='+data.ban[0].link+'><\/SCRIPT>"); ...

Hashing Using SHA1

Hi, I am doing an enhancement on our system and there is this other application that is already doing the hashing / ecryption but nobody knows what algorithm was used and we do not have access to the code. I have to do the same hashing using java or javascript for our system because I need to perform a search so I need to pass the corre...

AJAX.Upload Plugin

I am using the Ajax.Upload plugin (http://valums.com/ajax-upload/). I am trying to use the File Upload with text fields to submit it all to just one backend PHP file. The site mentions 'If you want to pass additional data from textfields use setData method in a onSubmit callback.' How can I set the parameters? Thanks. Also, if there a...

Monitoring http request header on a page

Possible Duplicates: Accessing HTTP Headers in Javascript? How do I access the HTTP request header fields via JavaScript? We can use httpwatch on IE or httpfox on Firefox to monitor http activity If i don't want to use any plugs on browser... Is it possible to monitor http request header on a page just by javascript? ...