I found this blog on del.icio.us I think. This is by far the best explanation of the various ways to use functions in javascript. Don’t stop with this one, look at all the other posts. There is some pretty advanced stuff here, and javascript isn’t going anywhere any time soon.
Programming
Internet Explorer Developer Toolbar
This toolbar makes my job a lot easier.
Protolize.org
Protolize.org is awesome! This is the best collection of web tools I have seen yet.
Mono Project
Now you can write AND run .net code on pretty much anything, for free. With Mono’s newest release, you can use Visual Basic. I’m not sure why you would want to, but you can if you feel the urge.
VB.Net and C# Comparison
Side by side comparison of VB.Net and C# syntax. This was very useful for me when starting out in C# since I already had VB.Net experience.
Javascript libraries roundup
Here is a great post containing a list of several javascript libraries. These are great for speeding up web development. Form field validation, ajax, visual effects… each implemented with usually one line of code.
Pixel2life Free Tutorial Search Engine
Pixel2life is an awesome source of tech tutorials including graphic design, coding, 3D animation, photoshop, and on and on. There are tons of things to learn there.
Modal Dialog Forms
Personally, I don’t like using Modal Dialogs because they are IE only – BUT some times thats what the client wants, so thats what they get. One of the biggest annoyances when using Modal Dialogs is the little quirk of opening a new window when trying to submit a form located within the dialog. The solution is easy enough, it just took a while for me to find so I thought I would post it here:
<head>
<base target="_self" />
</head>
Thats it. I don’t recall where I found this exactly, but it was on some message board after scouring Google search results for quite some time.
So, how do you tell whether to use modals or pops? Thats a pretty easy one too, but its a pain because of all the extra coding required:
var oInput = new Object();
var oReturn = new Object();
if(!window.showModalDialog)
{
//code for browsers not supporting modal dialogs goes here
//
window.open("testpop.htm","testpop","height:570px;width:700px;help:no;scroll:yes;"")
}
else
{
//code for browsers supporting modals goes here
oReturn = showModalDialog("testpop.htm", oInput, "dialogHeight:570px;dialogWidth:700px;center:yes;help:no;scroll:yes;");
tstFormElement.value = oReturn.value;
}
This is more robust than checking whether the incoming browser is IE or not, because who knows when or if the other browsers will integrate modal dialogs? Of course, this just handles opening the window. If you want to manipulate any data on the page opening the dialog/pop, you have to place a similar block in the opened page because the opener is referenced differently. Wait…what?
if(!window.showModalDialog)
{
//code for browsers not supporting modal dialogs goes here
opener.document.getElementById('elementID').value = "test value";
}
else
{
//code for browsers supporting modals goes here
var oReturn = new Object();
oReturn.value = "test value"
//place code to change values when this object is returned
}
So the last (?) hurdle here, is making your faux modal window act like a modal dialog, which is to say, it retains focus and does not allow the user to return to the calling window. I wrote a basic script – placed in the opening window – checking whether the opened window was still open or not. If it was still open, the opener returned focus to the dialog. This worked nicely at first, but when I started hammering away at it I could get it to fail. If anyone has a better suggestion, please let me know – just don’t bring up Mozilla’s modal=true bs, because its crap and it doesn’t work – at least not for me. And even if it does, its only for Mozilla.
There are probably other techniques for this, but these work adequately for me when I am forced to take this route.
Modal Dialogs are bad. If you feel you have no other choice, take a step back and find another way. It will save you blood, sweat, and tears.
Notepad++
Notepad++ is an awesome text editor. Its a great replacement for classic notepad. My two favorite features are visible line numbers and tab visualization. If you do any kind of coding and need a quick, lightweight text editor for those tasks too small to bring into a full service IDE, this is perfect.
Name Mangling, Solution 3
UPDATE:
Master pages are quite useful. Use them when applicable, but pay careful attention when you have thousands of lines of legacy javascript. I will leave the original post as is…this is a learning experience for me as well. Note my frustration below:
/UPDATE
UPDATE 2:
Paragraph 2 doesn’t make any sense to people that were not working on that project. I should have made this much more generic
/UPDATE 2
My suggestion: don’t use Master Pages. That is, until MS releases a tool to retrofit your existing javascripts or prevent master pages from name mangling. From what I hear, it is hell on CSS as well, but I haven’t run into that yet.
Instead, I just created 2 user controls, one containing the head of my layout, and one containing the footer. Simple enough for me, and I don’t have to waste time figuring out why my scripts don’t work. If that’s not good enough for you, you’ll need to make use of the .clientID property in your code behind pages – it just was not a viable option in my particular case.