Basic FBJS in Java

Creation QR-Code in Java Basic FBJS
Basic FBJS
Denso QR Bar Code Generation In Java
Using Barcode printer for Java Control to generate, create QR Code image in Java applications.
Displaying FBJS functions and properties added by Facebook to a DOM element
Barcode Drawer In Java
Using Barcode creation for Java Control to generate, create bar code image in Java applications.
Table 111
Read Bar Code In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
Overview of Select FBJS DOM Functions DOM Property
QR Code ISO/IEC18004 Encoder In C#.NET
Using Barcode maker for .NET framework Control to generate, create Denso QR Bar Code image in .NET applications.
parentNode
QR Code JIS X 0510 Creation In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
FBJS Function
QR Code 2d Barcode Generation In .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create QR Code 2d barcode image in .NET applications.
getParentNode()
Generate QR Code JIS X 0510 In Visual Basic .NET
Using Barcode printer for Visual Studio .NET Control to generate, create QR Code ISO/IEC18004 image in Visual Studio .NET applications.
Description
Paint UPC - 13 In Java
Using Barcode creation for Java Control to generate, create GTIN - 13 image in Java applications.
Gets a reference to the calling element s parent node Returns null if used to go beyond the root element of your FBML code Gets a reference to the next or previous element at the same level in the document as the current element Returns a reference to the first or last child of the current element Returns a read-only collection of the child nodes of the current element The list returned does not contain text nodes, unlike its DOM counterpart
Make Bar Code In Java
Using Barcode generator for Java Control to generate, create bar code image in Java applications.
getNextSibling() getPreviousSibling()
UPC A Printer In Java
Using Barcode generation for Java Control to generate, create UPC-A Supplement 2 image in Java applications.
nextSibling previousSibling
Code 3/9 Printer In Java
Using Barcode creator for Java Control to generate, create Code 3/9 image in Java applications.
getFirstChild() getLastChild() getChildNodes()
Creating Code 128 Code Set C In Java
Using Barcode printer for Java Control to generate, create Code 128 Code Set B image in Java applications.
firstChild lastChild childNodes
International Standard Serial Number Printer In Java
Using Barcode drawer for Java Control to generate, create ISSN image in Java applications.
FBJS DOM Document Object The document object wraps functionality provided by the native DOM document object present in all browsers as part of the W3D DOM Level 1 specificationThe FBJS version
Barcode Reader In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
11 FBJS, Mock AJAX, and Flash
Bar Code Maker In Visual Basic .NET
Using Barcode generator for .NET Control to generate, create bar code image in Visual Studio .NET applications.
offers significantly less functionalityTable 112 shows the details on some of the most important functions it offers
Barcode Maker In Visual Basic .NET
Using Barcode encoder for .NET Control to generate, create barcode image in .NET applications.
Table 112 FBJS document Functions Parameters (Type)
Generate Bar Code In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create barcode image in ASP.NET applications.
ID of DOM element (string) Element tag name (string)
Barcode Creation In .NET
Using Barcode creation for ASP.NET Control to generate, create bar code image in ASP.NET applications.
document Function
Code 128B Recognizer In Visual Studio .NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
Notes
Create Code-128 In VS .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Code 128B image in Visual Studio .NET applications.
Semantically equivalent to the familiar documentgetElementById() function Not documented in the Facebook documentation for FBJS, but it works like its DOM partner Facebook hides the global document and window objects from FBJS code This workaround lets you get access to the root node of your application content Can create normal HTML elements; however, for FBML, it is currently restricted only to the creation of <fb:swf> elements Replaces the normal DOM location property and can redirect the browser to a new URL
getElementById()
getElementsByTagName()
getRootElement()
None
createElement()
FBML/HTML element tag name (string) URL (string)
setLocation()
DOM Node Content Manipulation Facebook provides three functions that allow developers to set the content of a DOM nodeWhen FBJS first launched, not all these functions were available, so updating the content of an existing element with HTML was somewhat difficultThe functions Facebook provides have some quirks that we cover in the following section setTextValue() The setTextValue() function sets the text content of the node on which it s called When using it, you must be aware of a couple of things First, this only sets text values for the node If you add HTML markup as part of the value you want it to set, it is included as text, not markup Here s a quick demonstrationType the code shown in Listing 114 into the FBML Test Console FBML edit field
Listing 114 Using the FBJS setTextValue() Function
<h1 onclick='setNodeText(this);'>Click Me</h1> <script>
Basic FBJS
Listing 114
Continued
function setNodeText(elt) { eltsetTextValue('<h2>New Text</h2>'); } </script>
Now, click the Click Me text in the FBML Preview windowYou can see that the text changes from Click Me to <h2>New Text</h2> Notice that the <h2> tag is interpreted as text and not used to render the text in an <h2> elementThis function only sets or replaces the text within an element; furthermore, it removes all child elements of the node on which it s called, as Listing 115 demonstrates Clicking the text Click Me causes setTextValue() to replace the entire contents of the <h1> element, including the embedded <span>, with the text <h2>Thanks!</h2> The Facebook documentation states that no FBML or HTML tags are accepted by setTextValue() Listing 115 shows that s not entirely true; they are accepted, but they re simply inserted as literal text
Listing 115 setTextValue() Removes All Child Nodes
<h1 onclick='setNodeText(this);'>Click <span>me</span> please</h1> <script> function setNodeText(elt) { eltsetTextValue('<h2>Thanks!</h2>'); } </script>
setInnerFBML() setInnerFBML() sets static FBML content for an elementThere s one important requirement for using it:The value you pass to it must contain a reference to a block of FBML, not a string of literal FBMLThis can be somewhat confusing for those unfamiliar with its behaviorTo set FBML content dynamically for an element, you need to use AJAX, which is covered later in this chapter An example clarifies its use Replace the call to setTextValue() in Listing 115 with setInnerFBML() and execute it Notice that the Click me please text does not change as expected, but the FBML Test Console does not show any errors; however, Firebug displays an error:
fbjs_privateget(fbml_ref) is null fbjs_domprototypesetInnerFBML = function(fbml_ref) { var html=fbjs_privateget(fbml_ref)htmlstring; http://staticakfbcdnnet/rsrcphp//somefilejs Line 85
Observe in the text of this error that the setInnerFBML() function expects an argument named fbml_refThis FBML reference variable is an object created through the use of a special FBML tag, <fb:js-string>The purpose of this tag is to render a block of