javascript

Why does this javascript throw an undefined error?

I'd like to define my own onblur event for all text boxes in an application so that I can strip all high ascii values, so I wrote a script that runs on an asp.net master page that runs per page load, overriding all text box / area onblur events, and storing a copy of the old event. The new event then called the old event so it wouldn't ...

How to disable submit button once it has been click?

Hello All, I am having a submit button at the end of the form. I have added the condition onClick="this.disabled=true; this.value='Sending…'; this.form.submit();" in the submit button, but when it moves to the next page, the parameters did not pass and null values are passed. Can you please help ...

Change a default window size in browser

<form action="mail.php" method="post" target="_blank"> <textarea name="mess" cols="50" rows="5"></textarea> <input name="send" type="submit" value="Send"> </form> After pressing the button "submit", brouwser will open a new window with some text like "OK, your messagw sent to our mailbox". Can I make this "new" window NOT full...

Declaring a variable with html in it, and inserting the variable by using .insertAfter

I was wondering if I could declare html as a variable. In other words, something like this: $(document).ready(function(){ var Bold="Yes! There is bold in the text above!!"; var NoBold="No... There isn't any bolded text in the paragraph above.."; var BoldButton="<input class="BoldButton" type="button" value="bold" id="WelcomeBol...

JavaScript parameters coming from view's model data.

I've seen/read plenty advocating "unobtrusive" JavaScript contained in separate files. I'm preparing to combine all my JavaScript from three partial views into a single file that I will then reference somewhere in my master. My question is: is there any type of JavaScript that should remain behind in the html? One example that seems ...

"AJAX" Upload Issues with jQuery

I'm trying to create a simple "AJAX" uploader (as i know you can't actually do an AJAX upload). I'm having issues and i REALLY don't want to use a plugin. I'm writing an app that needs to have PDF attachments as part of a form, and my app's code is already at about 1000 lines of JS + jQuery. I don't want to add on an extra 1000k of SWFOb...

Set a hidden field value after postback.

I have a component that determines a value on a postback event. protected void Button_Click(object s, EventArgs e) { HiddenField.Value = 5; } There's more involved in the value of course, but HiddenField is an asp:HiddenField control with runat=server set. I have in my javascript: var id = $("#<%= HiddenField.ClientID %>").val();...

No alert popping up, although variable is defined, and syntax LOOKS correct..

Here's my code: $(document).ready(function(){ var Bold="Yes! There is bold in the text above!!"; var NoBold="No... There isn't any bolded text in the paragraph above.."; var BoldButton='<input class="BoldButton" type="button" value="Bold?" id="WelcomeBoldButton">'; $(BoldButton).insertAfter('#intro'); $(BoldButton).insertAf...

Using "window" and "document" in an iFrame.

I'm developing an iFrame Facebook application. The iFrame has a swf. We need to get access to that swf through javascript. This iFrame has a swf that needs to be put inside a Javascript variable so that we can call ExternalInterface functions from. Right now, our "flash" variable is undefined because we can't seem to access eleme...

html form values to a javascript array

how to insert values in a html table, an array multidimensional in javascript. Additionally, such as performing calculations between the columns of the array and insert the results into a column of the same array. thanks for your answers. ...

jQuery returning different heights for the same objects in WebKit (chrome) and Firefox

Im perplexed by this one. jQuery.height() is coming back with different values in Firefox and Chrome. Measuring the pixels on-screen indicates that of the two, Chrome appears to be reporting the correct value, while firefox is off by 2 or 3 pixels each time. Has anyone else encountered this issue? I've tried grabbing the height using t...

Get epoch for a specific date using Javascript

How do I convert 07/26/2010 to a UNIX timestamp using Javascript? ...

JavaScript Dropdown Lists: Select onClick

In a web application I'm working on, I decided to consolidate a few buttons by turning them into select elements of one dropdown list, with onClick events loading for each option pressed. However, this does not work in iOS (Safari on the iPhone). Is there a different event I can use to grab menu selection from Safari for iPhone? ...

Detecting changes to system time in JavaScript

How can I write a script to detect when a user changes their system time in JS? ...

why this is giving different month

the following code below var unixDate = new Date('07/28/2010'); var unixMonth = unixDate.getMonth(); var unixDay = unixDate.getDate(); var unixYear = unixDate.getFullYear(); alert(filterDate.value); alert(unixMonth); alert(unixDay); alert(unixYear); should give me month 07 but it alrets 06....whys that ...

Javascript tickbox validation

Hi guys, I am trying to add javascript validation to a bunch of check boxes, basically what I want is as soon as the user has selected 3 tickboxes, it should disable all of the tickboxes except the three that were ticked. How could I go about doing that? Thanx in advance! ...

What are the pros and cons of including Javascript right before the </head> tag vs the </body> tag?

Edit: While this question has been asked and answered before (1), (2), (3), the answers have not mentioned the possibility of using asynchronous and /or lazy loading when including files in the <head>. I was prompted to ask the question due to Google analytics new code which uses both of these methods. I recently noticed that Google a...

Correct way to fill un-needed callbacks in javascript

Consider this code snippet: transaction.executeSql( 'SELECT * FROM pv_master;', [], function(transaction, result) { if(result.rows.length == 0) { jQT.goTo("#register", 'slideup'); } }, errorHandler ); This example is a little different to the question title as the square brackets should be...

JQuery JEditable - How to Disable on click editing

Hi all, I was wondering if you can stop text being editable on click? I have a separate edit button to make the text editable and that's the only way that I want the user to be able to edit the text, so want to turn off the on click editing? Any ideas? ...

Showing and hiding buttons on hover

Hi, I'm trying to create an effect where if the user hovers the mouse over one of my li items, I show a few buttons that were hidden in the non-hovered state. Same kind of thing youtube is doing when you hover your mouse over comments. I'm trying this: var gButtons = $(generateButtons()); function generateButtons() { var html = "<...