javascript

javascript method post - how to call asp.net mvc action onClick?

i have an image: <img onclick="Search()" alt="searchPage" style="vertical-align: middle;" height="17px" src="../../Stylesheets/search.PNG" title="search" /> and javascript methode: <script language="javascript" type="text/javascript"> function Search() { alert("test-search"); var searchText = $("#txtSearch")....

Run time error handling on lazy loaded javascript?

Does anyone have any ideas how to do error handling on lazy loaded javascript? I am using an approach in which an ajax request is called and the code is eval'd in global scope. When a runtime error is struck, it spits out the filename as my lazy loading script and the line number is the error line plus the line number of my eval in my ...

Lock orientation of webapp for iPhone iPad iPod

Im struggling to lock orientation of a webapp. For example want the site to be permanently in orientation view. And advice appreciated. ...

Regex to match from 0.0 to 150.0 (including floating point)

I have a problem: i should match values from 0.0 to a specific double value (for example, i should match from 0.0 to 150.00 including value as 12, 21.23213, 149.111) anyone can help me? i tried everything. i used this regexp for match by 0.0 to 60.0 but it doesn't work (^0(\.[0-9]+)?$|^[1-9]{1}(\.[0-9]+)?$|^[1-5]{1}[0-9]{1}(\.[0-9]+...

Is is possible to determine when an element has been rendered using JavaScript?

Is there a jQuery equivalent to do the following: $(document).ready(function() { for an element: $(a).ready(function() { I have content in an updatepanel and I am calling jQuery UI's .button() on some anchor elements. After the updatepanel refreshed, the anchors are rerendered and lose the UI styling. I already know how to detect ...

how can i close my jquery ui dialog when i submit a form?

i load a form into a jquery ui dialog. i have a submit button (inside my form - NOT the actual dialog buttons) that calls a controller action but i can't figure out how to close the dialog after the submit is called as i dont have any event handler that i am attaching. is there anyway of doing this besides changing the submit to inpu...

how to use event bubbling cancellation

Hi All I've looked everywhere for a code on how to stop event bubbling to occur, and I've found one from the Quirksmode website, which is this: function doSomething(e){ if(!e) var e = window.event; e.cancelBubble = true; if(e.stopPropagation) e.stopPropagation(); } But I don't know how and where to use it. What is the 'e'...

How to retrieve a value from jquery in C# user control?

I have a visitorID variable in ToDo function in external javascript. I want to assign its' value in a user control. Front End Code: <asp:HiddenField ID="hidVisitorID" runat="server" Value="-1"/> <script type="text/javascript"> $j('#<%= hidVisitorID.ClientID %>').val(ToDo.visitorID); </script> In the back end it says, that hidVisit...

How do you organize large JS/jQuery code bases across your entire website?

How do you organize large JS/jQuery codebases across your entire website? There are plenty of good resources on how to organize pieces of your code, but nothing really about how to pull it all together and fit each piece into place: side wide code organization, multiple pages using the same code, staying DRY with loose coupling, etc. B...

Google maps - G_HYBRID_MAP undefined error

I'm getting an intermittent problem with a google map (api v2) - "Error: 'G_HYBRID_MAP' is undefined". I'm trying to reference that variable in a function that is called on the document ready event, via jquery, i.e. <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=[key]&amp;sensor=false" type="text/javascript"><...

Proper way for links to execute javascript code

So there are 4 main methods I'm aware of to execute javascript code from a link. For my requirements, I need to do so without moving the screen anywhere (linking to # and not returning false is bad). SEO for the executed javascript code, if possible, is important too. So what's the right way to do this? method 1 (need to make sure my...

How do I handle dependencies in my JavaScript module?

I've been writing some pseudo-oop JavaScript using the Module pattern. I'm curious, what is the best way to handle dependencies on libraries in my JavaScript modules? For example, if my module makes use of the jQuery or Underscore libraries, is there a way I should be passing in a reference to those, or should I just use them assuming ...

Error message first appears at the top left then at center

i am using a label for showing error messages <div id="errorMessage"> <asp:Label ID="lblError" runat="server" BorderStyle="Solid" Text="" Visible="false"></asp:Label> </div> in the server side whenever i am showing error message Page.ClientScript.RegisterStartupScript(this.GetType(), "errorMesssage", "showError()...

How to call UserControl javascript when parent page submits to server?

Hi I have an asp.net usercontrol located on on my aspx page. In the usercontrol there is a javascript function that I would like to fire everytime the page that contains the usercontrol submits to the server. (directly before this happens) Ideally I prefer to not have to write any code in the parent to make this happen, but I am not sur...

Javascript strings - getting the char at a certain point

Hi, I have a variable: var text = "hello"; I want to get the 0 positioned character, so: var firstChar = text[0]; Simple. In firefox and chrome this works. In IE however i always get back 'undefined' Any ideas why this might be happening in IE? ...

What's new for developers in Mobile Safari iOS 4.2

Does anyone know what the changes are to Safari in the iPad OS update coming in November, from a web application development standpoint? Is there any expanded support for hardware acceleration, any changes to JavaScript, etc, etc? ...

Does JAWS read ActiveX content?

If JAWS does not read ActiveX content, how should I go about making this website 508 compliant? Here is a code excerpt: <SCRIPT LANGUAGE="javascript" FOR="posXUserForm" EVENT="ControlInitialized" > try { posXUserForm.SchemaLoadObject.URL = "form.xsd"; posXUserForm.XML...

Grid won't refresh everytime. Can I do a whole window refresh?

How do I create a Javascript method in here that RELOADS the .aspx page, that I can call during one of those other existing methods. <%@ Page Language="VB" Inherits="Core.Web.BaseView(OfLending.Controllers.Workspace.DocumentUploadData)" %> <%@ Import Namespace="Framework.WebControls.Forms" %> <%@ Import Namespace="Framework....

setting checkbox value

I have this code: $('#chkBox').click(function() { $('#hiddenBox').val($('input').is(':checked')); }); I want it to be where if i click on the checkbox, in my hidden field, I set the value to true else if it's not clicked, the value would be false. Can anyone help? ...

Using Google Analytics without sending query string data

We're doing a simple implementation of Google Analytics on our ASP.NET with jQuery/AJAX web, and for most of it we just call _trackPageview and let Google do the rest. We do a lot of data transfer in query strings, and recently, management became concerned that a lot of our data (such as product numbers) would be sent to Google. Withou...