javascript

How to unregister from an ActiveX event in JavaScript

I have successfully used the Automagic syntax to register to an ActiveX event from JavaScript. How do I later unregister from the event? Example: function MyActiveXObject::SomeEvent() { alert("event raised!"); } Edit: included example ...

call javascript/ajax function from php

i have a little problem here!! after i submit my form, based on php response i want to execute another javascript or ajax function! this is my form: <form id="uploadForm" onsubmit="ytVideoApp.prepareSyndicatedUpload( this.videoTitle.value, this.videoDescription.value, this.videoCategory.value, this.videoTags.v...

Javascript Error : Is Null or Not an Object

hi techies i am using html inputbox , which is inside update panel i need the cursor to be set focused on that inputbox once the page is loaded so i called a function as follows < body onload="javascript:document.Default.UserInputTextBox.focus();" > but i getting the following Javascript error, Microsoft JScript runtime error: 'docu...

How do I keep a Label, Button, or TextArea as a single line?

Lets say I have a Label, Button, or TextArea object, that contains some amount of text. The way that things work by default is that text put in these objects will automatically word wrap around to the next line. Is there a way to disable this? I am aware that the CSS attribute overflow : hidden ; will stop the scrollbar from showing ...

How do I get the total horizontal width in characters of a Label, Button, TextArea, or TextBox?

The Label, Button, TextArea, and TextBox (abbreviated LBTT from now on) are capable of displaying strings of text. Is there any way to look at a already sized LBTT object, and determine the number of characters that might fit per line of the given object. For instance, let us say that I have a textArea that is fixed in its width. Is the...

using public/private keys in javascript

Hi, I need to send an ajax POST request to my server. I'll need to make sure that the request originated from the script itself, and not from a user writing the request him/her self. Is there any secure way to do this? Can the script sign or encode the POST request, later to be decrypted by the server's private key? and can I somehow p...

Dynamic (AJAX) HTML creation

I'm seeking input on this topic, as explained below. In particular I am looking for a "best known method" or design pattern regarding how to dynamically build HTML. This is a very common task for me: Submit something to a server via a POST --> get a list of results back in JSON format --> take this list of 0 to n results and display th...

Retrieving <select> form parameter when name exists multiple times

I have a situation where I have multiple drop down lists that are hidden or shown depending on the situation. I will always show one of the drop down lists. So for example, I might have something like this: <select name="number"> <option value="1">1</option> <option value="11">11</option> </select> <select name="number"> <optio...

JavaScript: Can I add decimals?

for( count = 0.01; count <= 0.20; count + 0.01 ) Is this valid? Because it seems as soon as I changed it to this from count++, my firefox crashed. ...

is it bad practice to require php files rather than link to js and css?

I want to put snippets like these inside of a few php files and then require them in my main page, instead of using "pure" css and js files. I mean, I already do essentially this for my HTML DOM. this: <script type='text/javascript'> var foo = <?php echo $bar; ?>; </script> or this: <style type='text/css'> .foo{ background-image:url...

Unselect textbox on blur with jQuery in IE8

I'm trying to have the default behavior of a form select (or highlight) the text when you tab to the next input. I've had to add the .select() function on my password form fields for this to work in IE8. Is there an equivalent to the jquery .select() for deselecting text? $("#MyTextBox").focus(function() { $(this)...

Restrict attaching big files using Javascript.

Hi All, How can we restrict users from attaching file bigger than specified size (to say 20MB). I do have a check at the server side to show errors in case of big files received on the server but that happens too late. I want to achieve something like gmail, where you get a quick alert specifying "This file exceeds the 25MB attachmen...

localscroll's hash option, flickers the page when scrolling. How can I make the scrolling smooth

I'm implementing a jquery plugin (localscroll) to smooth scroll to named anchor elements withing a page. localscroll supports an option called 'hash', what it basically does is it appends the named anchor hash into the URL making it easy for the user to bookmark and move using the browser back/forward buttons. HTML <ul id="navigation...

Detect window closing event in Gecko based browser

How to detect window closing event when user press Alt+F4 or using javascript window.close() in Gecko based browsers? ...

What does this JavaScript/jQuery syntax mean?

What does the following syntax mean? (function($){ $.fn.columnize = function(options) { ... What’s function($)? What’s $.fn. …? ...

Why am I getting syntax error (JavaScript) trying to do a pagination?

Why am I getting a syntax error with this? $(document).ready(function() { $.post(some_url + "ajax/get_matching_products", { user_id : user_id_hash, url : user_page_url }, function(data) { var callback = eval("(" + data + ")"); //alert(callback.output); if(callback.result == 1) { ...

Why can't I use addition like this in foreach?

Javascript's foreach equivalent: for ( var i in products ) { document.write("Write" + i + 1 ); } Output: Write01 Edit: I tried parsing i into an integer. for ( var i in products ) { document.write("Write" + parseInt(i) + 1 ); } ...

How to scrollTop a span outside an iframe from within the iframe

My site is affiliated in another site iframe. The hosted site got the iframe on fix height inside a span with a scroll (don’t ask why). I’m looking for a way to change the span scroll (with JS) from within the iframe (where my site is). I know it can be done because I use JqueryUI dialog with position:top (inside the iframe) which sc...

Need to get the value of a variable which is sent as a string?

Hi I'm sending a string as parameter to a function, but i already have a global variable in that name, i want to get the value of that variable but its sending as undefined.. My example code i have a array as reg[0][0],reg[0][1],reg[1][0],reg[1][0],reg[2][0],reg[2][1] and i have some global variables as tick1, tick2, tick3... it wil...

JavaScript, getting value of a td with id name

Originally I was using input with an id and grabbing it's value with getElementById. Currently, I'm playing with <td>s. How can I grab the values of the <td>? Originally I used: <input id="hello"> document.getElementById("hello").value; Now I want to get value of <td>, but I don't know how; <td id="test">Chicken</td> <td>Cow</td> ...