How will taking upper level undergraduate courses online affect graduate admissions? My dilemma: I'm interested in potentially going to graduate school to obtain my PhD in math with an ideal career as a professor at a research university. I entered undergrad as a computer engineer and didn't add a math major until the end of my third semester. In my school, you have to select electives to satisy an "elective focus area" (cohesive plans of study in fields such as data mining, signal processing, applied physics, etc). My field of study is currently software engineering, something that still interests me. I'm still early enough in my undergraduate career (going into my fifth semester) where I could alter my focus area to include many more upper-level and graduate math courses instead of continuing on the software track. However, I'm hesitant to do so because I know that software engineering is a lucrative field with significantly more job availability than math academia and I would likely enjoy my work as a software engineer.

My inclination: Given that software engineering is something that I'm interested in (although not as much as math) and the job market isn't quite as cutthroat, I'm inclined to continue on my path while trying to sneak in a couple upper-level math courses that have crossover -- large data analysis, numerical methods -- where I can. I could work in industry for a few years after graduating. Ideally, I would be able to take one or two courses a year throughout this period, most likely online, that would solidify my mathematical background and make me a more desirable student when applying for grad schools. 

My question(s): Would taking a solid portion of my post-calculus mathematics coursework online have any adverse affect on my graduate admissions? Would it matter if the coursework came from my undergraduate university or from a variety of institutions? Are there other unconsidered obstacles in my inclined path?
Given your terminology (you wrote "research university"), I'm going to assume you're in the US.

This is a bad idea.  Admissions committees will have no idea how to evaluate the online classes, and will probably not put very much weight on them.  As @ff524 notes in his comment, you will not have any good letters of recommendation, which are essential for an application which is a bit outside the norm. You are incredibly unlikely to get a spot in a graduate program that is likely to result in a becoming a professor at a research university if you depend on online classes instead.

So, what should you do instead?  Well, first reconsider if being a math professor is what you want.  You're absolutely right that there's a real risk of it not working out, and a lot of competition.  But if by trying to keep your options open, you do less to make yourself a qualified candidate (both on paper, and in actual point of fact), then you're just putting yourself at a disadvantage, and making your chances that much worse.   You will be in very bad shape if you don't get a BA which includes a math major, and take a lot of advanced math courses (more than the bare minimum required for a math major!) in person with faculty at a well-respected research university.  Note, that doesn't necessarily preclude getting another major.  

On the other hand, there is good news.  The people who get BAs in math, or start mathematics grad school and don't finish, or who finish but don't get an academic job (or one they want) do find other things to do.  If you have complementary skills in computer programming, then you will be very well set up to do a lot of things.  I don't suggest starting a math PhD as preparation for a job at Google, but I do know several math PhD's who do have such jobs.  So, if getting a BA in math and then perhaps a PhD in math feels like what you want to be doing in the moment, then I think you can reasonably do it, and figure you will find a job if the academia thing doesn't work out.