javascript

changing selected values in select box

Hi guys, Well here is my code to do it. But as you can see, its ugly. Anyone got any better ideas? .delegate(".ui-icon-plus", "click", function() { var d = $(this).parent().data("val"); var values = $(obj).val(); values.push(d); $(obj).val(values); $(this) .removeClass('ui-icon-plus') .addClass('ui-icon-minus') ...

javascript variables

I need to access javascript variable: var geocoder = new google.maps.Geocoder(); function geocodePosition(pos) { geocoder.geocode({ latLng: pos }, function(responses) { if (responses && responses.length > 0) { updateMarkerAddress(responses[0].formatted_address); } else { updateMarkerAdd...

There is a long suffering, but I can not do cross- site request

What now is: A page on localhost, which sends a request: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <title></title> <script language="javascript" type="text/javascript"> var script = document.createElement('script'); script.setAttribute('src', 'http://www.3dfind.r...

Encoding and decoding between Javascript and c#

I want to be able to send data to Javascript in a div like this: <div class="dontDisplay><%= myData %></div> However, the challenge is that the HTML will get messed up. There seems to be a plethora of encoding and decoding schemes out there, but I can't find a javascript/C# pair that are guaranteed to be compatible for all possible i...

JSF 2.0 AJAX: Call a bean method from javascript with jsf.ajax.request (or some other way)

Some background: I am building a custom JSF component. The component is basically a text editor and it should have a "Save" -button for saving the content string of the editor. As I am using the CodeMirror library, I need to fetch the content (string) from the editor with javascript and send that to the server. Therefore, in this case I ...

Toggling span tag on and off with JQuery

Hey guys, I'm trying to toggle the contents of a span tag on and off using a jquery function. I'm using a span tag as I want the contents to be inline with the rest of the data on the line when it gets toggled. On page load the image I want to toggle appears inline and in the correct position, however upon toggling the image re appear...

workaround for tabindex on firefox on macos?

Is there any work-around with javascript/CSS for tabindex not working on Firefox on Mac OS? without changing Mac OS system keyboard-preference? ...

Set div as background of other div

We have two divs. divOne contains information of image and divTwo contains information of table. Is it possible that we can set divOne as background image of divTwo using script? divOne.innerHTML = <IMG src="http://sbc.com/xyz.jpg" /> divTwo.innerHTML = <TABLE id="content"> ....... </TABLE> ...

cross-site request

Should be done with the site number 1 request to the site number 2. Let the number one site will be localhost, and the site number 2 - the real server on the Internet. At site 2 there is a file result.php, which takes GET-requests: $var = @$_GET['q'] ; $s = $_GET['s'] ; $typefile = $_GET['type']; If the page result.php make a requ...

ASP.NET Javascript Error on Input

My ASP.NET page has an <asp:TextBox /> whose text input is encoded via HttpUtility.HtmlEncode(); The page also contains validators such as <asp:RequiredFieldValidator /> and <asp:CustomValidator /> as well as several AJAX toolkit <toolkit:ValidatorCalloutExtender /> If the user inputs </ as the text in the textbox, a Javascript error ...

JQueryUI: automatically add .accordion(); functionality to any new elements with class="accordion"

I'm using the JQuery-UI Accordion, but I'm trying to find a way to not have to initialize it any time any new element is added. Using AJAX I'm inserting html into a page, but on any page load I am having to re-initialize any accordions- // .ajax handler success: function(xml) { // find accordions $("div.accordion").accordion()...

How to open a jQuery Facebox after validation?

Hello, I want to open a facebox modal after some javascript validation. I am using this code: <script type="text/javascript" src="facebox.js"></script> Script: function validatePage() { if(document.getElementById('username').value == '') { alert('Please enter Username'); return false; } //My Code should go h...

Create new object within a for-in-loop

I want to create a new object and assign some properties for each array stored within some json. I have this mostly working except... for (var i in json) { a = 0; a++; a = new Object(); for (var key in json[i]) { var Key = key; var Value = json[i][key]; ...

showModalDialog, dialogArguments and ASPX Pages

In a scenario we use frequently here, we display old classic ASP pages as modal dialogs using window.showModalDialog. When the page is loaded, we read the dialogArguments property and away we go. Now, as far as a classic ASP page goes, that's fairly a no-brainer. But things got a little complicated when we upgraded some of those pages ...

jQuery .show, .fadeIn not visible with IE7

Below is the jQuery code I am attempting to use. It works well in Firefox, Opera, Chrome, Safari, but not IE7. I was at first suspicious that this was because of the :hidden selector not being supported in IE7, so I tried to simply .show() and .fadeIn() the element without conditions (you can see this from the commented out area). if (...

Javascript return false in if statements

Hey all, Is it good practice to use "return false;" to basically say do nothing in an if statement? For example: if (navigator.userAgent.match(/iPad/i) != null) { return false; } else { //Usual script here } just wondering if there are any downfalls to this. I can use the if statement without the else but i'm just wanting to ...

Dispatching in an HTML/Javascript Application

I am in the process of creating an HTML application, in the sense that there will only be one HTML page and the rest will be done as AJAX using jQuery. I will be storing context in the hash of the URL to preserve the back button and allow external deep-linking from our main site. I will use onhashchange to detect a request for new co...

USC google maps ajax + json

I was just wondering if there are any tutorials on how to get as advanced with the google maps api. http://web-app.usc.edu/maps/#upc Specifically, I want to know how to use json for the search function. thanks guys :D ...

HTML5 localStorage adding to value with script

hello, I'm trying to use localStorage to register the right answers to an offline game. I've got the key and value stored, and can alter it using the bode below. I'd like each right answer to add to the localStorage.right plus 1 then move to the new page. Any ideas? Thank you in advance ...

How do I assign javascript variable to php variable? With out submitting the form

hi friends can some one tell me How do I assign javascript variable to php variable? I am actually getting a value through javascript and I want the javascript values to be assigned to php variables. With out submitting the form. ...