Setting Layer Backgrounds (W3C) : Layer « HTML « JavaScript DHTML

Home
JavaScript DHTML
1.Ajax Layer
2.Data Type
3.Date Time
4.Development
5.Document
6.Dojo toolkit
7.Event
8.Event onMethod
9.Ext JS
10.Form Control
11.GUI Components
12.HTML
13.Javascript Collections
14.Javascript Objects
15.Javascript Properties
16.jQuery
17.Language Basics
18.Mochkit
19.Mootools
20.Node Operation
21.Object Oriented
22.Page Components
23.Rico
24.Scriptaculous
25.Security
26.SmartClient
27.Style Layout
28.Table
29.Utilities
30.Window Browser
31.YUI Library
JavaScript DHTML » HTML » Layer 
Setting Layer Backgrounds (W3C)

/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function setBg(URL) {
    document.getElementById("bgExpo").style.backgroundImage = "url(" + URL + ")"
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Layer Backgrounds (W3C)</H1>
<HR>
<DIV ID="buttons" STYLE="position:absolute; top:100">
<FORM>
<INPUT TYPE="button" VALUE="The Usual" onClick="setBg('http://www.java2s.com/style/logo.png')"><BR>
<INPUT TYPE="button" VALUE="A Big One" onClick="setBg('http://www.java2s.com/style/logoRed.png')"><BR>
<INPUT TYPE="button" VALUE="Not So Usual" onClick="setBg('wh86.gif')"><BR>
<INPUT TYPE="button" VALUE="Decidedly Unusual" onClick="setBg('sb23.gif')"><BR>
<INPUT TYPE="button" VALUE="Quick as..." onClick="setBg('lightnin.gif')"><P>
<INPUT TYPE="button" VALUE="Remove Image" onClick="setBg(null)"><BR>
</FORM>
</DIV>
<DIV ID="bgExpo" STYLE="position:absolute; top:100; left:250; width:300; height:260; background-color:gray" >
<SPAN STYLE="font-weight:bold; color:white">Some text, which may or may not read
 well with the various backgrounds.</SPAN>
</DIV>
</BODY>
</HTML>


           
       
Related examples in the same category
1.Layer 'srcFilter' Example
2.Monitors divisions (or layers) on dynamic Web pages (DHTML)
3.Hide and show layer
4. Layer Background Colors (W3C)
5.The layer while rolling over the link.
6.Accessing Layers with JavaScript
7.'layer' and 'ilayer' Tag Properties
8.Detecting Navigator and Internet Explorer
9. Adjusting Layer clip Properties (W3C)
10.Comparison of Layer and Clip Location Properties (W3C)
11. Testing Nested Layer Coordinate Systems (W3C)
12.Nested Layer Visibility Relationships (W3C)
13.Relationships Among zIndex Values (W3C)
14.Dragging a Layer (W3C)
15.Resizing a Layer (W3C)
16.Methods and Properties of the Layer Object
17.Layer seek
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.