javascript

pass value as array/collection

I have this code: var addNew = $('#divListBox').find(':checked') .map(function() { return $(this).val(); }).get(); I want to know if there's a way to get all the value that's checked and put them in a collection so I can send it to my controller? ...

mouse click somewhere else on page (not on a specific div)

I want to close a little pop-up box in page when user has clicked anywhere on the page other than box area. how to find it? ...

Google Maps API: Adding letters to my markers on my google map

I'm trying to add a letter to my marker and then have multiple markers (14 to be accurate) with letters. l have so far done this without success. I'm a complete novice with code and google API. Can you tell what code l need to add and where? Below is my code: <script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;am...

How do JavaScript interpreters/engines work?

Hi, I'm interested to find out how the JavaScript interpreter (engine if you like) works. I'm aware that JavaScript isn't compiled.I have looked at the ECMA specification, but it doesn't explain how the actual engine works. The main reason why I'm asking this is because I'd like to understand why IE7 behaves slightly differently to IE...

Closing <script>

This is a stupid question, and I am aware that it is; but never the less, here it comes: Is it possible to close a <script>-tag within itself, so to speak? I mean if you are using an external javascript-document can you close the tag like this: <script type="text/javascript" src="xxx.js" /> ...

Display Image in fixed size div

I've a 100*100 <div> in which I would like to display images of different sizes randomly without stretching them. Note:The image should appear as origional, just resizing should be done inorder to place it in box ...

XML and Javascript: the right tool for the job?

Hello, For years I've been reading about XML and I have just not quite grokked it. Most documents I see about it simply explain the syntax (extraordinarily easy to understand) and say that it's portable: I've worked with Unix my whole life so the idea of putting things in plain text to be portable is hardly revolutionary. My specific ...

why break this up javascript fragment?

Possible Duplicate: Why split the <script> tag when writing it with document.write()? I don't really do Javascript programming and was hard to google this but have seen something like this in a couple of different places (by good developers): document.writeln('<scr'+'ipt src="'+pcheck+'" type="text/javascript"></scr'+'ipt>');...

get file names from uploadify jquery plugin

Hi, that is my first post I am trying here, to get the names of the files that are uploaded, so that the user can delete it if desired, the same way as yahoo. $("#uploadifysub1").uploadify({ 'uploader' : 'JS/uploadify.swf', 'script' : 'JS/uploadify.php', 'cancelImg' : 'cancel.png',...

How to display the file path from the input file tag?

Hi, I have a screen as shown in the below image. Once a file is selected, I need to display the selected file name with complete path in the "Import Files". I suppose, it has be done with the javascript. Someone, please give me an idea how to achieve this functionality. ...

how to deal with multiple ids in query as i have problem in the following code

<head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("input").click( function(){ alert(this.id); $('#comments'+this.id).show(); } ); }); </script> <style type="text/css"> .comments{ width:500px; height:350px; backgroun...

Json replacing values in a loop

I've a large JSON string describing some data. I'd like to loop through this and replace value of all properties named "Key". How can I achieve this using jQuery or plain Javascript? ...

JavaScript error when trying to fire simple XMLHttpRequest (GET)

Bit of a JavaScript newbie here - I am firing this basic bit of JavaScript code from my website as a test: var req = new XMLHttpRequest(); req.open('GET', 'http://www.google.co.uk/', false); req.send(); if (req.status == 200) { alert(req.responseText); } and I keep getting the following error: [Exception... "Component return...

jQuery ASP.net webservice consumption

Hi, I have been looking on how to consume a webmethod using the $.ajax call using this code below: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "WebService.asmx/HelloWorld", data: "{}", dataType: "json", success: function(msg) { ...

How can I cause a local HTML to page save text to a local file?

I'm writing a simple HTML+JavaScript app, intended to load from a local file and run in the user's browser. It will allow them to enter some text into a textarea... and must also allow them to save it! So this is my problem: given that JavaScript doesn't have access to the local file system, how can I cause this text to be saved? ...

How can I load a data table after the page loads ?

I would like to load data in a table but I would like to do this after the page loads. The actual page has a table, a textbox, and a search button. I was thinking ajax would help, but I am yet to find a good solution for my problem. How do I do this? Javascript, Jquery or otherwise. <table class="roundAll" > <tr class="titleRow"> ...

Apple,Banana,Mango,Ananas and Kiwi - Can I reorder the order?

Hello all, sort() orders the elemts alphabetically: var fruits = new Array("Apple", "Banana","Kiwi", "Ananas", "Mango"); Namen.sort(); document.write(fruits); Well, I don't want the alphabetical order...it should be like var reorderFruits = new Array("Kiwi", "Apple","Mango", "Banana", "Ananas"); Is it possible to reorder the order...

Getting back the event handler returns undefined

The following codes don't work: function dnd(){ } var ele = document.getElementById("relative"); ele.addEventListener("click",dnd,false); document.write(ele.onclick); the output is undefined. I guess the output should be function onclick(event){dnd();} What should I do to solve this problem? Any suggestion is appreciated. ...

Jquery Div sort and order =)

Hi All, The problem i have is i need to group certain divs together and reorder them, and if it was all animating it would be cool. Please see below: <div id="away">Some Content</div> <div id="online">Some Content</div> <div id="offline">Some Content</div> <div id="away">Some Content</div> <div id="online">Some Content</div> <div id="o...

Why does this jQuery code doesn't work (getScript)

Hello, I'm trying to use the jQuerty getScript function. But seems like nothing happens - the script isn't called at all. What's wrong? here's the page -> http://ultimateclassicmovies.com/uncategorized/botr-test/ The relevant code block is at $.getScript("http://content.bitsontherun.com/players/UhLR1fcb-Gv5Rv0Kc.js"); this l...