javascript

Does Javascript's new operator do anything but make life difficult?

I come from the traditional web developer background where I can by no means claim to really know anything about Javascript, however I am trying. I currently have what I would describe as a fairly novice understanding of JQuery, a slightly better understanding of closures, and I've read through, and feel like I am fairly clear on Dougla...

How to check which images/css/javascript are used in web app?

The other day I found this little piece of software - WARI. It stands for Web Application REsource Inspector. Apparently it checks dependencies between css, html, js and images and reports unused and duplicated css styles, javascript functions and images. Link: WARI is released! What do you use? Any alternatives? ...

JavaScript spam filter

I tried to make a spam filter for my e-mail by JavaScript. Unfortunately the code won't be passed by a validator. Can anyone say what are the mistakes in my code in http://jaakkospage.comyr.com/ ? If you want to contact, please send me an <script type="text/javascript"> // Email obfuscator script 2.1 by Tim Williams, University of Arizo...

JavaScript: Check width of a <div> object before placing it

Consider: $("#PlotPlace").append('<div style="position:absolute;left:200px;top:40px;font-size:smaller">Hello world!</div>'); I need to execute that line only if the width of the resultant text would be less than 60px. How can I check the width before placing the object? ...

what approach/module in joomla should I use?

Hi, Here's my need. I'm building a site that let users add product to a list (something like a wishlist without a cart). Now my question is, Is there an existing extension in Joomla (1.5) that do similar thing? Another Is calculating the total cost of the product and calculating other factors, like discounts, freight, weight etc. I am...

Use Custom Validator at client side ? Shown ErrorMessage when script is wrong?

I have one problematic question on custom validator at client side in asp.net? This is my fileupload control and customvalidator to check that uploaded file is doc or not!!!! <asp:FileUpload Id="fu_1" runat="server" /> asp:CustomValidator ID="cv_fu1" runat="server" ControlToValidate="fu_1" ValidationGroup="submit" ClientValidationFunct...

Ajax-ish updating of a canvas element

Ok this is more of general technology/approach question. We have a very simple web 'app' which is basically just a canvas element. We're using javascript to draw a 'fancy UI' on the canvas. We register a mouseclick event, get the coordinates and then try to figure out what widget they clicked on. My question is, what technology or fram...

Passing data without using cookies in Javascript.

Is there a way to pass data between pages without using cookies and a server-side language in javascript? every way I found incorporates cookies or a server-side language (PHP session vars). ...

Select List Generated using JSON and jQuery appends empty options

I have a field that represents a zip code of a user. When the user leaves that text box, an AJAX request is sent to the server to receive cities that may be associated with that zip code. I am trying to use the JSON received from that request to populate a select list to replace the text box that is currently assumed for city (if one ci...

having problem with this ajax module !

i am having problem with this javascript, its reloading the page and not submitting the form. ! var xmlHttp function GetXmlHttpObject(){ var objXMLHttp=null; if (window.XMLHttpRequest){ objXMLHttp=new XMLHttpRequest(); }else if (window.ActiveXObject){ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXML...

Merge JavaScript objects

I've read another similiar question on SO but there wasn't a clear answer at that question. I got some JavaScript objects that look like this: var moveJSON = { 'name' : move[0].innerHTML, 'info' : move[1].innerHTML, 'power' : move[2].innerHTML, 'accuracy' : move[3].innerHTML, 'type' : move[4].innerHTML, 'cat...

Add list of dates to array, validate, and get max value

Hi, i have some input fields like below: <input type="text" name="date_1" class="dataList" value="2009-12-30" /> <input type="text" name="date_2" class="dataList" value="2007-06-12" /> <input type="text" name="date_3" class="dataList" value="2009-10-23" /> <input type="text" name="date_max" class="result" value="0000-00-00" /> I mus...

PHP json_encode and javascript functions

I need to encode a javascript function into a JSON object in PHP. This: $function = "function(){}"; $message = "Hello"; $json = array( 'message' => $message, 'func' => $function ); echo json_encode($json); outputs: {"message":"Hello","func":"function(){}"} What I want is: {"message":"Hello","func":function(){}} ...

Making a URL W3C valid AND work in Ajax Request

I have a generic function that returns URLs. (It's a plugin function that returns URLs to resources [images, stylesheets] within a plugin). I use GET parameters in those URLs. If I want to use these URLs within a HTML page, to pass W3C validation, I need to mask ampersands as &amp; /plugin.php?plugin=xyz&amp;resource=stylesheet&amp...

See what content is not sent over HTTPS

I created a page that is HTTPS only. On my browsers, I always get a warning that the page includes resources that are not secured. I just can't find out why! Looking at the source code seems fine. All img src and javascript tags are using relative path (/images/...). It does not consider href links as resources does it? Is there a way t...

Modify form action with javascript

I've got a multiple step webform written in c#/asp.net. I'm trying to change the url that posts back to for google analytics reasons. I've written the code below to change the url on the client side, but it doesn't seem to post to the url with the parameters on the end. Almost like it's being changed back on the client side onsubmit. ...

How to Limit DOM interaction to an element and its children?

I am building a modular frame work for a PHP MVC site. I am using Jquery. I have a registerModule('module_name') method that when called creates an instance of a module object with this name. These module objects are functions that return an object they are contained within individual script files example of test_module.js core.modou...

build form field names dynamically in javascript and assign values

function updateValues(res){ var rows=res.ROWCOUNT; for (i=0;i res is a JSON object passed to the function and we need to dynamically build form fields names and assign values to these fields (the form field name that are dynamically build will exist in the form) ...

Different UI for Dojo DND than when item is displayed

I have a set of items that can be dragged / dropped using Dojo DND, that part has already been implemented and all is working well. The specific question I have is that I'd like to display very different data both in terms of content and visually while the item is being dragged than the initial view of the item, which is what is present...

JavaScript memory problem with canvas

I'm using getImageData/putImageData on a HTML5 canvas to be able to manipulate a picture. My problem is that the browser never seems to free any memory. Not until I close the tab (tested in Chrome and Opera). Moved these out of the function: var ctx = document.getElementById('leif').getContext('2d'); var imgd = ctx.getImageData(0,0...