sfsdf

3
Dom inside it : Obejects like div tags. Every obj has properties. Ex: dom: div.style.id <html> <head> </head> <body> </body> </html> <div id="my_div" style="background-color:red" >This is my div</div> Style is a child obj. , that carries properties. <div id="my_div" background="red" >This is my div</div> <div id="my_div" background="red" >This is my div</div> { } curly braces () paranthesis <script> var divObj = document.getElementById("div1"); if ( divObj != null ) { alert(divObj.style.backgroundColor) divObj.style.backgroundColor="orange" divObj.style.width="600" } else { alert("didn't find it "); <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

description

dsfsd dsfsdg sfsdf

Transcript of sfsdf

Dom inside it :Obejects like div tags.Every obj has properties.

Ex: dom: div.style.id

<html><head>

</head>

<body></body></html><div id="my_div" style="background-color:red" >This is my div</div>

Style is a child obj. , that carries properties.

<div id="my_div" background="red" >This is my div</div>

<div id="my_div" background="red" >This is my div</div>

{ } curly braces () paranthesis

<script>var divObj = document.getElementById("div1");if ( divObj != null ) { alert(divObj.style.backgroundColor) divObj.style.backgroundColor="orange" divObj.style.width="600"}else { alert("didn't find it ");

<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head>

<body><div id="div1" style="background-color:yellow;width:200px;height:300px;border:1px solid red;position:absolute;top:100;left:400;z-index:2;">div 1</div>

<div id="div2" style="background-color:yellow;width:200px;height:300px;border:1px solid red;position:absolute;top:50;left:300;z-index:1;" >div 2</div><input type="button" value="Click Me" onclick="changeColor()">

<script>function changeColor() { var divObj = document.getElementById("div1"); if ( divObj != null ) { alert(divObj.style.backgroundColor) divObj.style.width="600" divObj.style.backgroundColor="orange" } else { alert("didn't find it "); }}</script>

Get reference to an objet by ID !

// forwad slash skips the order after it

Another way to type a div html way or java way , same thingdivObj.style ="background-color:yellow;width:200px;height:300px;border:1px solid red;"

divObj.style.width="200";divObj.style.height="300";

homework:

2 divs, 200x 200 both dimentions

1 is at 300 L 300 top

The other same 600 L top 300

On click we want it only 50 px away yani -250