1. Construct a JavaScript Library
Copy codeThe Code is as follows:
(Function (){
// Register the namespace IC to window
Window ['jshide '] = {};
// Hide the sidebar and change the image to the right arrow
Function yc ()
{
Document. getElementById ("cloone"). style. display = "none ";
Document. getElementById ("img "). innerHTML = " ";
}
Window ['jshide '] ['yc'] = yc;
// Display the sidebar and change the image to the left arrow
Function xs ()
{
Document. getElementById ("cloone"). style. display = "";
Document. getElementById ("img "). innerHTML = " ";
}
Window ['jshide '] ['xs'] = xs;
})();
2. Insert the JS file into the HTML file:
"Insert" -- "HTML" -- "script object" --- "script". Select the script file and insert it into the HTML file.
3. HTML file code
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> javascript partition mode </title>
<Script language = "JavaScript" type = "text/javascript" src = "JS/JSHide. js"> </script>
</Head>
<Body>
<Table width = "425" height = "198" border = "1">
<Tr>
<Td id = "cloone" width = "55" align = "center" valign = "middle" scope = "row">
<P> <a href = "iftest .html" target = "_ blank"> Topic 1 </a> </p>
<P> <a href = "forcycle .html" target = "_ blank"> Column 2 </a> </p>
<P> <a href = "css .html" target = "_ blank"> column 3 </a> </p>
<P> <a href = "1add 100.html" target = "_ blank"> Topic 4 </a> </p>
<P> <a href = "js .html" target = "_ blank"> Topic 5 </a> </p>
</Td>
<Td width = "102" align = "center" valign = "middle">
<Span id = "img">
</Span>
</Td>
<Td width = "71" align = "center" valign = "middle"> here is the content area </td>
<Td width = "169" align = "center" valign = "middle"> <input type = "text" name = "textfield" id = "txtid" value = "yesle" /> </td>
</Tr>
</Table>
</Body>
</Html>