Ok, it's my turn at public service. The "ex" in ex-dividend means "without." If you buy the stock on that date, it means you don't get the upcoming dividend (the reason is because you won't become a record holder by the time of the record date). Conversely, if you own the stock and sell it on the ex-dividend date, you will get the dividend because you will still be the record owner on the record date.
The opening trading price of a stock on its ex-dividend date is adjusted downward by the amount of the dividend (because the dividend is being paid to the people who owned it on the previous day). The stock price can still go up or down from this opening level depending on the usual factors of supply and demand, overall market movement etc.