javascript

foreach equivalent of php in jquery?

Is there a foreach code in JQuery as in PHP? I have a code in php,like <?php foreach ($viewfields as $viewfield): ?> if("<?php echo $viewfield['Attribute']['required'];?>"=='true'){ $("<span class='req'><em> * </em></span>").appendTo("#fb_contentarea_col1down21 #label<?php echo $viewfield['Attribute']['sequence_no']?>"); } ...

Finding beginning and end quotations

I'm starting to write a code syntax highlighter in JavaScript, and I want to highlight text that is in quotes (both "s and 's) in a certain color. I need it be able to not be messed up by one of one type of quote being in the middle of a pair of the other quotes as well, but i'm really not sure where to even start. I'm not sure how I sho...

Flex datagrids - Alternatives in non-flex/flash environment ?

I did some work that used Flex datagrids previously. It was smooth for the users and developers alike. In my current project, I have to implement the same grids but not using Flex / Flash. I have taken a look at extJS and YUI but they don't seem to measure up. Are there other packages I should be looking at ? ...

Should I use ondeactivate or onblur when leaving a input textbox?

I have some HTML inputs and I need to run some javascript when the user exits them however I have always used onblur but a colleague has suggested ondeactivate. I can't find much info about ondeactivate and thought it was an old method for old browsers. Will onblur run on older browsers? ...

How can I count the number of lines a bunch of text wraps to inside a div?

I have a div with text loaded from a database in it. I have no control over the length of the text and want to calculate or count the number of lines it wraps to so I can hide all except a small segment at the beginning until a user clicks on "more". Is there any way to do this with javascript? Thanks in advance. ...

What's a more secure alternative for eval() when I just want to call a function?

I know PHP has call_user_func, I was just wondering if JavaScript had something similar, where the method I want to call is, for example: object.set$fieldID($fieldValue) I would rather not go through if/else/switch blocks just to execute one line of code properly. If it helps, I am using jQuery. ...

Read XML file using javascript.

Hi friends, My XML file format is as below. <markers> <marker> <type></type> <title></title> <address></address> <latitude></latitude> <longitude></longitude> <marker> <marker> <type></type> <title></title> <address></address> ...

Prototype make option in select be selected by provided value

Hello, I have: <select id="country" onchange="updateHtml(this.value);"></select> populated by options (country list) using Protype: for (var i = 0; i < j.length; ++i) { var opt = new Element('option', {value:j[i].country}) opt.innerHTML = j[i].country_name; country.appendChild(opt); }...

How do I get this to render in IE6?

Cannot work out how to get the following menu to display correctly in IE6, any ideas? Demo: http://www.jankoatwarpspeed.com/examples/vimeo_navigation/ ...

JavaScript: Convert string to value of predefined variable

I have a JavaScript object that looks like the following: venue = function(map, dataSet) { // set some constants this.VENUE_ID = 0; this.VENUE_NAME = 1; this.VENUE_CITY = 2; this.filterBy = function(field, value) { ... var filterValue = 'parent.VENUE_' + field; } } Now, the problem is that I ne...

Post Back response from PHP to javascript [SOLVED]

Dear developer, I'm new to forms and post data ... so I don't know how solve this problem! I've a php page (page1) with a simple form: <form method="post" action="/page2.php"> <input type="search" value="E-Mail Address" size="30" name="email" /> <input type="submit" value="Find E-Mail" /> </form> How you can notice ... this form pos...

Simulating "focus" and "blur" in jQuery .live() method...

Update: As of jQuery 1.4, $.live() now supports focusin and focusout events. jQuery currently1 doesn't support "blur" or "focus" as arguments for the $.live() method. What type of work-around could I implement to achieve the following: $("textarea") .live("focus", function() { foo = "bar"; }) .live("blur", function() { foo = "fi...

smart way to shorten long strings with javascript

Does anyone have a more sophisticated solution/library for shortening strings with JavaScript, than the obvious one: if(string.length > 25) { string = string.substring(0,24)+"..."; } ...

using google map after logging

I have a project witch is using googleMap, when I used localhost googleMap works correctly and anythings is OK, but when I deploy it on the other computer the site can not work(don't show google map!!!). I got a valid key but stil this problem exists! please help me! ...

Weird browser / ajax error : Extra junk appears at the end of javascript files in firefox

This is a weird one. We're writing a Django application with some rich javascript UI, using both Yahoo YUI and jQuery. Our main page template now includes a fair number of js files. And we're starting to see a strange error in Firefox (3 and 3.5) . Sometimes the javascript crashes. And inspecting in Firebug we see that a syntax error o...

combine javascript files at deployment in python

Hi, I'm trying to reduce the number of scripts included in our website and we use buildout to handle deployments. Has anybody successfully implemented a method of combining and compressing scripts with buildout? ...

How can I make the relative paths to JS & SWF files in HTML work?

I have created a simple flash menu and the SWF file, JS files (swfoject.js and flying.js) & XML files are in a folder called "icpmenu_es" on the server root. If I open the SWF file on my local HDD it works fine but if I alter the paths to the files for use on my website, it won't work at all. I know it has found the JS files because if I...

Download or just save an image file from a website using js

Hi friends, I want to download or just need to save the image file from a website using the javascript in pure coding itself.. Because i want to download nearly 1000 jpeg, so i would like to write a function to call and download those images. URL is available, from that i want to download the specific image Please guide regarding this...

Sharepoint Javascript Lists

Hi, Is it possible to iterate through a survey response list using javascript on a webform in Sharepoint? Is it also possible to iterate through a user group list as well - again using javascript? Additionally, is it possible to create a table or list or something to: a) Display a group of users b) Display their responses to a survey ...

How to add combo box in WMD

How to add combo box in WMD(Markdown) ...