javascript

Is there a Javascript MVC (micro-)framework?

Are there any client-side Javascript MVC (micro-)frameworks? I have a rather complicated HTML form and it would benefit from the MVC pattern. EDIT: I imagine a good solution would provide the following: Model and View update the Controller when values change (Observer pattern) Populate the model from the form data when the page load...

Time delay on click

Can anyone send me javascript code on how I can construct a time delay from the time I click a button on a page to the time the function called by the button click is executed. I am a novice with javascript, and I have some code that performs a function when I click a button, and I just want to have a time delay. Thanks. ...

Setting focus on postback initiated by javascript

I am working with ASP.NET doing some client side javascript. I have the following javascript to handle an XMLHTTPRequest callback. In certain situations, the page will be posted back, using the __doPostBack() function provided by ASP.NET, listed in the code below. However, I would like to be able to set the focus a dropdownlist control...

Removing images with Greasemonkey?

I would like to stop images from loading, as in not even get a chance to download, using greasemonkey. Right now I have var images = document.getElementsByTagName('img'); for (var i=0; i<images.length; i++){ images[i].src = ""; } but I don't think this actually stops the images from downloading. Anyone know how to stop the ima...

How do I check if the required fields in an html form are filled?

I've got a submission page in php with an html form that points back to the same page. I'd like to be able to check if the required fields in the form aren't filled so I can inform the user. I'd like to know how to do that with php and javascript each. However, I imagine this is a common issue so any other answers are welcome. ...

How do you properly detect the browser's support for opacity?

I've got some javascript code that applies an alpha transparency. Before it does that it attempts to detect what type of transparency the browser supports and stores that in a variable for use later. Here's what the code looks like: // figure out the browser support for opacity if (typeof br.backImg.style.opacity != 'undefined') op...

Javascript mechanism to autoscroll to the bottom of a growing page?

Hopefully, this will be an easy answer for someone with Javascript time behind them... I have a log file that is being watched by a script that feeds new lines in the log out to any connected browsers. A couple people have commented that what they want to see is more of a 'tail -f' behavior - the latest lines will always be at the bott...

What's the best way to define a class in javascript

While I'm not entirely new to javascript I have very little knowledge when it comes to best practices. In particular, I prefer to use OOP in large scale projects like the one I'm working on right now. I need to create several classes in javascript but, if I'm not mistaken, there are at least a couple of ways to go about doing that. Can...

How to stop event propagation with inline onclick attribute?

Consider the following: <div onclick="alert('you clicked the header')" class="header"> <span onclick="alert('you clicked inside the header');">something inside the header</span> </div> How can I make it so that when the user clicks the span, it does not fire the div's onclick event? ...

How do I access query parameters in the request content body in javascript?

If I use a GET to request a page, then I can access any query parameters from javascript using window.location.search. Is there a similar way to access query parameters which are in the request content body rather than the request location, when the page is a result of a POST? ...

Why does jQuery wrap itself in a function?

I was reading the jQuery source and I was wondering why the entire source file was wrapped in an anonomous function. (function(){ ... })(); Is this something which helps not to pollute the global namespace? Why is it there and how does it work? ...

implement listener

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>YUI Calendar Control Example</title> <link rel="stylesheet" type="text/css" href="yui/build/calendar/assets/skins/sam/calendar.css"> <script type=...

ASP.NET TreeView javascript before postback

Hi, I'm trying to code what I think is a fairly routine AJAX pattern using TreeViews and UpdatePanels. My situation is this: I have a TreeView within an UpdatePanel. I have a Literal within another UpdatePanel. When the user clicks on a node within the TreeView, the contents of the Literal are updated. Now, since the whole thing is asy...

javascript cannot call an element in array

Ok, let me explain more... the goal is to make the checkbox checked if there's a change on select. The actual code was: function checkit(date) { document.forms[0].date.checked = true; } <input type="checkbox" name="date[]" value="2008-08-14">Aug 14, 2008<br> <select name="slot[]" size="1" onchange="checkit(date[]);"/> <option val...

what is the best way of including a JS file from JS code?

what is the recommended way of including a Javscript file from another Javascript file? ...

HInclude Caching problem on Internet Explorer

Hi, I've been using HInclude (http://www.mnot.net/javascript/hinclude/) for sometime now and its working great but there is one problem though. The part of my site which is fetched using HInclude doesn't get refreshed everytime I hit the back button in Internet Exploer (6.x + and 7.0 also). It works fine on other browsers. I've tried se...

Problem in implementing the listener

YAHOO.namespace("yuibook.calendar"); //define the lauchCal function which creates the calendar YAHOO.yuibook.calendar.launchCal = function() { //create the calendar object, specifying the container var myCal = new YAHOO.widget.Calendar("mycal"); //draw the calendar on screen myCal.render(); } //define the showC...

a question about eval in javascript

thank you. here is the correct question: { "VID":"60", "name":"\u4f1a\u9634", "requireLevel":"20", "levelMax":"5", "venationRequirement":"0", "description":"\u6c14\u6d77\u4e0a\u9650\u63d0\u9ad8[Affect1]\u70b9", "cost":{"1":"240","2":"360","3":"400","4":"600","5":"720"}, "difficult":{"1":"1024","2":"973","...

Debugging javascript in Safari for Windows

Is there a way to debug javascript using Safari 3.2 in Windows Vista? I found a link to a debugger named Drosera but I can't get it to work because the information seams to be outdated. ...

Regular expression for allow only numbers

I want to check the following with regular expression {Today,Format} Today - will be remains as it is. In the place of Format, we can allow the digits from 0 to 12. for example: we have to allow {Today,0} {Today,1} {Today,2} ... {Today,12} and also have to allow {Today,} {Today,Format} Please help me and also refer me to some ...