javascript

Lightweight echo server

I'm writing a JavaScript application which should let the user to load & save files in his/her PC. To do so, I need a basic server used only to echo loaded and saved files between the client and the server, since JavaScript doesn't have direct access to files. What's the most lightweight solution to this problem? ...

<script>...</script> inside a repeater control code not showing up in the source code on page render

I have a repeater control where the <%#DataBinder.Eval(Container.DataItem, "Display")%> part doesn't show up. The code that the "Display" stores is set as follows: item.Display = "<script type='text/javascript'>AudioPlayer.embed('ffcedea7- 4822-465f-85b6-89924f7b81fa', {soundFile: 'http://s3.amazonaws.com/blah/af8g7fd3-1793 -4b5e-92b7-9...

Hide/Show Column in an HTML Table

I have an HTML table with several columns and I need to implement a column chooser using jquery. When a user clicks on a checkbox I want to hide/show the corresponding column in the table. I would like to do this without attaching a class to every td in the table, is there a way to select an entire column using jquery? Below is an exa...

Jquery Event Bubbling CheckBox

I have a form with checkboxes and then text to the right of the checkbox. There are jquery events attached to the click events of the the checkbox. What I want is to allow the user to click on the label or the checkbox and have the checkbox check/uncheck and the event to fire. Below is a simplified version of what I'm trying to do (DO...

Does asp.net remove <script> tags in repeaters and inside the <% for loop %> in mvc

I have some script type="javascript"/script tags inside both a repeater and a for loop in mvc. On page render the script is gone and is not displayed both inside the repeater and the for loop (they are separate). Is there some option I need to set to stop this from happening? Has anyone had this happen to them? ...

How to make Collapsible comment box like Stackoverflow

I am building a site and I have a list of status updates and I want to allow the users to write comments for each of of the items in the list However I am trying to implement a UI similar to the way stack overflow works specifically the collapsible comment form / list where a user clicks on add comment on the specific status update in t...

Function overloading in Javascript - Best practices

What is the best way (or ways) to fake function overloading in Javascript? I know it is not possible to overload functions in Javascript as in other languages. If i needed a function with two uses foo(x) and foo(x,y,z) which is the best / preffered way: Using different names in the first place Using optional arguments like y = y || ...

Is there a way to detect when an update panel is done refreshing?

Is there a way to detect when an update panel is done refreshing? I want to fire some javascript methods when the update panel is finished. Perhaps via the UpdateProgress control? ...

Altering IFrame attributes from within the IFrame source. Is it possible?

On my computer, I'm using a custom adblock based on HOSTS redirection (so I can have adblock in Chrome). I'm running IIS on my machine, so I have a custom blank 404 error that displays when an iframe-based ad is displayed on a page. I've modified my 404 error to inherit its background color from its parent so that the ad doesn't look o...

How to add callback function to a javascript class?

The following code in javascript gives me the error "this.callback is not a function function ajaxRequest() { var httpObject; this.open = open; this.callback = function(){}; function getHTTPObject() { if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRe...

Problems with HTML <marquee> tag

Actually I am trying to move some box alternatively with in another box. I made it work, but both the blocks do not interrupt each other. What should I do? How can I make the blocks cross each other? I try using style:position, but it is not working. Here is the code I have been using: <marquee direction="down" behavior="alternate" scr...

hashtable in javascript

Dear All I am Using Hashtable in javascript, I want to show the values of following in Hashtable one -[1,10,5] two -[2] three -[3,30,300 ..etc] I have found following code it work for following data one -[1] two -[2] three-[3] How to assign one-[1,2] values to hash table and how to ac...

Verify a date in JavaScript

I need to do user validation of a date field, it should be in the format yyyyMMdd and should not be more than one year in the future. How would I go about doing this? Currently I only have a crude regexp which is insufficient. function VerifyDate(source, args) { var regexp = /^([1-2]{1}[0-9]{1})\d{2}([0][1-9]|[1][0-2])([0][1-9]|[1-2...

Javascript: how to set "this" variable easily?

I have a pretty good understanding of Javascript, except that I can't figure out a nice way to set the "this" variable. Consider: var myFunction = function(){ alert(this.foo_variable); } var someObj = document.body; //using body as example object someObj.foo_variable = "hi"; //set foo_variable so it alerts var old_fn = someObj.fn...

How do I disable tabs for <a> tag

Hi, I am using tags for links on a web page. How do I disable tab key from selecting either of them. ...

How do I get the correct ClientID for my ASP.NET TextBox?

I have created a a subclass of Table in my ASP.NET project which creates. The table uses a class that formats and creates TableRows and TableCells which we can call RowCreator. So MyTable calls rowCreator.CreateRow() and gets back a TableRow with a lot of goodies in it. In this TableRow there is a TextBox which is supposed to trigger a ...

Disabling browser tooltips on links and <abbr>s

Hello, I want to suppress the web browser's default tooltip display when a user hovers over certain links and elements. I know it's possible but I don't know how. Can anyone help? The reason for this is to suppress the tooltip for microformatted date-times. The BBC dropped support for hCalendar because the appearane of the machine-read...

Based on how they are constructed, can callbacks also be defined as closures?

In JavaScript, I know that a closure is can be defined as a nested function that has access to its containing function's variables. For example: function outerFunction(x, y) { function innerFunction() { return x + y + 10; } return innerFunction; } Now, the following code is wiring up a callback for the onreadystate...

YUI Checkbox Button - retrieving the checked value

(I've tried posting this on YUI message group but without any luck) Can anyone tell me how to retrieve the checked state of a yui Button? I've tried by creating the Button in code, which is then outputted as a HTML button but this only changes the title attribute. When I use checkboxes instead, none of the checkboxes are checked (when ...

Pass parameters in setInterval function

How to pass parameter while call a function using setInterval. viz. setInterval('funca(10,3)',500); is incorrect. ...