javascript in facebook pages/tabs

I simply want some tabbing functionality on a facebook application (business) tabs

I have some basic HTML and JS [fbjs], this doesn't seem to work I have no clue whats wrong.

<div id="foo">foo div</div>

function changeText(evt){ = "none";

var foo = document.getElementById('foo');
//--> </script>

What am i missing?


It works for me in Chrome. What browser are you using? Are you sure the page you are embedding this code in doens't contain another element with id "foo"?

Facebook actually alters the JavaScript and DOM environment in which your scripts run when you run them in Facebook. FBJS (Facebook JavaScript) sets up several wrappers around things like events and DOM elements. That means that things like will not work. If you want to get or set the styles of an element, you're going to need to use DOM_Element.getStyle() and DOM_Element.setStyle() instead.

Events work like the W3C specifies:

From the docs:

//add event listener to 'foo' div (mouseover & mouseout)

Need Your Help

Does MVC pattern negate other design patterns?

oop design-patterns model-view-controller

So usually when working with the MVC you have a controller that controls the input a model that process it and makes it ready for the user and a view that display the "result" to the user.

Show element based on $scope variable value

angularjs ng-show

I am new to AngularJS and am trying to figure out how to show an HTML element based on a variable value.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.