javascript

Prototype: wrapping raw HTML to create extended element

Hi all I am reading in a complex chunk of HTML and I'd love to be able to walk this sub-tree of HTML in the same way I can the DOM. Is there a way in Prototype to take a raw chunk of HTML (say from an AJAX call) and 'wrap it' in some way so that it becomes a Prototype element and thus allow me to search it using .up() .down() etc? ...

Working example for JavaScriptResult in asp.net mvc

Can somebody provide a working example of JavaScriptResult in asp.net mvc. I understand that it returns javascript which is then executed on the client side and also that the content type of the response is set to text/javascript. I need some working example to see this thing in action. ...

How to turn off dragable behaviour on Google Maps V2 (javascript)

Hello Experts! I'm trying to set up a Google Maps on device and on top of it show some simple buttons. But events that I attach to those buttons seems to interferee somehow with map drag functionaliy. Basically drag completly doesnt work and also gives me this button not workin. I really dont care about this drag (I dont need it) - but ...

Localization Helper, How to retrieve values from javascript?

Hello guys, I used localization helper from Matt Hawley. It's really working great. I have a problem though in getting the values on javascripts/jquery. I can't retrieve the resources text using this: example: alert('<%=Html.Resource(\"Strings,SomeKey\")%>'); Any help is greatly appreciated. Best ...

Best practices for login form modal window

Hello, I want my web site to open login form in a modal div window (like thickbox works). So I see 2 questions here: Client validation - should I send from javascript plain login & password in POST request to the server? Is it safe to do so? Using of IFrame. Login link will be on every page in top right corner, so I'm just thinking ab...

Is it possible to change the keyboard type when using the prompt() Javascript function when using Mobile Safari on the iPhone?

Mobile Safari on the iPhone allows you to specify different keyboard types for text input boxes as demonstrated in the Safari How-To's for iPhone, here. However, I'm wondering if it's possible to change keyboard type displayed when a Javascript prompt() dialog is displayed. I know I can roll my own modal pop-up if I have to, but I'd ...

javascript-php var post get

That code work: startSlideshow(<?php echo json_encode(glob("photos-animaux/*.jpg"))?>); that code dont : $.post("",{'folder':'animaux'}); startSlideshow(<?php echo json_encode(glob("photos-".$_GET["folder"]."/*.jpg"))?>); WHY ?, what i am doing wrong ?, help ! why the stupid php fonction just dont make the string right !! ahhhh! ...

javascript function that returns two string values, how to do this neatly?

I need to store values that would look like this: "somekey": "value1", "value2" So I want to create a function that will take in "somekey", and it will return "value1", "value2". It doesn't have to be a function, it could easily be a collection that I initialize in my javascript file and then reference like: var v1 = blah("somekey")....

Detect non-printable characters in JavaScript

Is it possible to detect binary data in JavaScript? I'd like to be able to detect binary data and convert it to hex for easier readability/debugging. After more investigation I've realized that detecting binary data is not the right question, because binary data can contain regular characters, and non-printable characters. Outis's q...

Do I need to escape these in javascript?

My strings will hold the values: "[" "[/blah]" do I need to escape anything? Is it just doubling the /? ...

Need to include #anchor after querystring list

Hello, Form is 'get' to a API which operates off of querystring. One of the parameters is a PackageID which indicates a vacation package. In order for the packageID to appear I also need to append '#packages' to the end of the get request. Since not all form 'get' have a package I need this to be dynamic. I've tried adding a hidden fi...

How to get a DOM Element from a JQuery Selector

I'm having an impossibly hard time finding out to get the actual DOMElement from a jquery selector. Sample Code: <input type="checkbox" id="bob" /> var checkbox = $("#bob").click(function() { //some code } ) and in another piece of code I'm trying to determine the checked value of the checkbox. if ( checkbox.eq(0).SomeMethodToG...

Ordering in javascript

How easy/hard is it to order collections in javascript (alphabetical and numerically). Say I have a collection like: var map = { user: { id: "23434", username: "mrblah" }, user: { id: "1010", username: "johnskeet" } }; And I want to order the collection by id and username. Update correction thanks: var map = [ { id: "2343...

How to change a link into a span of text or some kind of non-anchored element with prototype

I have a link: <a id="theLink" href="h***://stackoverflow.com">Go to SO</a> How can I use prototype to either strip <a>'s or just leave the innerHTML so that the elements becomes: [h***://stackoverflow.com] (something that is no longer clickable)? Or maybe convert the <a> to a <span> ...

window.location.href opens another window

For some reason when I set window.location.href = it opens another window. window.location.href = 'https://MyDomain.com/Checkout/Purchase.asp'; It doesn't happen in my development environment, only production. The only only thing different that I can think of is that we are switching from http to https. If this were a straight link ()...

JavaScript: How do I create JSONP?

I have a two domains, example1.com and example2.com From example1.com, I would like call a JSON API I have on example2.com. Knowing that this is not allowed, it occurred to me - this is exactly why JSON**P** was created. Question is, how do I modify my JSON API to make it JSONP capable? Basically, how do I create the callback api? UP...

Concerned with javascript calendar

hi guys, I am calling javascript calendar to textbox like this <asp:TextBox ID="txtStartDate" runat="server" onfocus="showCalendarControl(this);" ></asp:TextBox> Problem is in textbox date is coming as mm/dd/yyyy.I want to see in textbox as dd/mm/yyyy.Can anybody help? folowing is js code function positionInfo(object) { var ...

What is xhtml's role attribute? What do you use it for?

I have read w3's page on this here, but it is still vague to me. Is the role attribute's purpose to clarify the code? Or will it be interpreted by some browsers or spiders? Can it be used as a dom selector using some javascript libraries (I am thinking that since the id attribute has to be unique, this could be use to identify multiple...

stopping key event bubbling in safari 4 windows

In safari 4 windows, it does not seem possible to stop some key events from bubbling up to the browser in javascript. This guy got pounced on for trying to stop F5 (a dubious design goal), but the technical problem remains... how do you stop certain key events from bubbling up in Safari 4? For example, You can stop: CTRL+T CTRL+N ...

JQuery: Google Maps "bounce" using JQuery Bounce package

Does anyone know of a way to make a Google Maps marker "bounce" using JQuery Bounce package? ...