javascript

How to get jQuery validate success function to operate on a hidden input field?

Hi all! I have a form being validated by jQuery.validate. Using errorPlacement option I have a custom set of functions for real-time error validation. Using success option I have a custom set of functions to get rid of and replace error messages. All works great except my validation on hidden fields only works on submit. With the su...

Capturing onkeydown in Javascript

I have a web front-end to an AS/400 CGI application which allows the use of some of the F1-F24 keys (depending on the page) as well as page-up, page-down etc - these are passed to the underlying application which handles them appropriately. For instance, on a given page, a user could either press the F3 button or press the F3 key - both ...

Can I apply CSS to the elements within an iframe?

Hi folks, I often see sites using iframes containing an external site, and a top frame containing JavaScript functionality for the user. e.g. user analytics software, Digg bar, etc... Any tips for experimenting on something similar? =) Would be awesome to know ...

Any way to show a piece of html over another website, that I linked to?

I have a website that indexes large amounts of links. I wanted to put a header on top of the website, when I link out to it, so I could show similar stuff, as well as the site's name. Similar to the Digg Bar on digg.com Unfortunately many sites have framebreakers. I saw the framebreaker buster code poster here, but it just results in a ...

Cakephp, dynamically write variables into css file upon load of view?

I'm working out a process to save actions that occur from jquery in my view in cakephp.. I figure an easy way to load the saved values, such as the width and height for a DIV, would be to have cakephp echo a variable as their width / height in the css file, much the same way it would do this in the view file.. I guess I'm not sure exactl...

window.open and .Net WebServices

I don't know exactly the cause of this symptom but here goes. In our web app, we call window.open to open a new window/tab (internally everyone's is set to open in a new tab). After opening this new tab, IE8 immediately switches the focus to it. We then integrated a web service, so we call this web service which in turn invokes a callb...

Is it possible to use any HTML5 fanciness to export local storage to Excel?

Title says it all. This question is similar, but doesn't highlight any possibilities to export the data. Thoughts? ...

how to clean the css style of jquery-ui be added automatically when someone use ".draggable()"

this is my code : <style type="text/css"> #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; border:1px solid #DDDDDD; color:#333333; background:#F2F2F2; } #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; border:1px solid #E78F08; ...

Why is img src not working as <asp:Image ImageUrl does

Hi, I'm currently trying to get a img tag to show the image by settings its src property. I was using an asp:ImageButton as: asp:ImageButton ID="image" runat="server" ImageUrl='<%# "Images/" + Eval("CarMakeId") + ".jpg" %>' AlternateText="No image found" /> This showed the image fine but I wanted to do some javascript for clicking th...

update textarea value, but keep cursor position

I have an html textarea that will be updated periodically via javascript. when I do this: $("#textarea").val(new_val); The cursor moves to the end of the text. I would like to update the text without changing the cursor position. Also, if the user has a range of text selected, the highlight should be preserved. ...

link css and javascript to xcode iphone app

I have copy and pasted the css and js files for Copy Bundle Resources and removed them from Compile Sources. How do I "link" or "import" them so I can use the css and javascript files? Can anyone enlighten me? ...

Can someone explain to me why this inheiritance in javascript doesnt work?

function SuperClass() { var self = this; self.someVariable = true; } function SubClass() { var self = this; self.name = "Sub"; } SubClass.prototype = SuperClass; var sub = new SubClass(); alert("This is a sub class with name " + sub.name + " and variable " + sub.someVariable); </script> </head> <body> </bod...

Remove all multiple spaces in Javascript and replace with single space

How can I automatically replace all multiple spaces with one single space in Javascript? I've tried with just chaining some s.replace but this doesn't seem optimal. I'm using jQuery as well in case it's a builtin functionality. ...

Only fire one click event when polyline is clicked in Google Maps (v3)

For Google Maps V3, I have some code that created a marker when a polyline was clicked. I also have some code that creates a marker when the map is clicked. Earlier today, when I clicked on the polyline, only one marker was created (I'm guessing it didn't fire a map-click event). Now tonight, I have not changed my code at all, and it ...

JQUERY - IF the element's current value ends with !!!, trigger an Alert

Given: var value = $this.text(); Where value equals: Phasellus pellentesque metus in nulla. Praesent euismod scelerisque diam. Morbi erat turpis, lobortis in, consequat nec, lacinia sed, enim. Curabitur nisl nisl, consectetuer ac, eleifend a, condimentum vel, sem. When the user types in: Where value equals: Phasellus pellentesque me...

Problems accessing element style attribute with javascript

I am trying to access the style attribute of a element in order to display a form however, I get this error: Uncaught TypeError: Cannot read property 'style' of undefined. The example below is a simplified example. cookies.php echo "[a href='test.php?flavor=butter']Bake Butter Cookies[/a]"; echo "[a href='test.php?flavor=choco...

JSON or XML or other data format with jQuery ajax()?

For a data send, where the return data contains potential updates for hundreds of elements on a page, is XML or JSON or another data format better, for usage with jQuery's various parsing formats (invoked via ajax() success)? ...

Save state using HTML5 Web SQL on window unload

I'm using the Web SQL API to store some information on a page; I'd like to save the state of the page when the user closes the page or navigates away, thus, I start with: window.onunload = function () { db.transaction(function (tx) { executeSql("INSERT INTO State (foo) VALUES (?)", [foo]); }); }; However, this is asynchronous ...

How to check ASP.NET Forms Authentication Status Using Only JavaScript?

The reason i need to do this is because of Facebook Connect - which is another story, so i'll save you the drama for that. =) Anyway, i have this function that runs on window.onload: function userAuth() { SomeFunctionWhichGetsFacebookCookes(); if (!loggedInUsingFormsAuth && loggedInViaFacebook) { window.location.reload(); //...

How to set the JSTL variable value in javascript?

How to set the JSTL variable value in java script? <script> function function1() { var val1 = document.getElementById('userName').value; <c:set var="user" value=""/> // how do i set val1 here? } </script> How do I set the 'user' variable (JSTL) value from 'val1' (Java script)? ...