ThomasJSmart
Programmer
- Sep 16, 2002
- 634
im playing around trying to learn more advanced javascript.. there are 2 things i realy want to learn/do
1. creat and attach a div. this works in FF but its not working in IE6
im wondering why not?
i would like to learn to do the following with this:
a function that receives an objectID for an existing object (a textfield), i would like to creat a holder div around the textfield, then add another new div after the text field so it looks like this: <div id="holder"><input type="text"><div id="foo"></div></div>
the 2nd thing i would like to solve has to do with functions and global variables, would this be solved with a class?
i have a set of functions that generally make a list of dynamic objects from an array, these functions use a couple of global variables, all works great as long as i have only 1 part of the page using these functions, if i need 2 parts of the page using them it all goes to hell because of the global vars now being double used...
I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
1. creat and attach a div. this works in FF but its not working in IE6
Code:
<div id="holderTest" style="border:solid 1px #009966; width:200px; height:100px;"></div>
<script type="text/javascript">
var holderDiv = document.createElement("div");
holderDiv.setAttribute("class","Sdiv");
holderDiv.setAttribute("style","display:block");
var appendTo = document.getElementById('holderTest');
appendTo.appendChild(holderDiv);
</script>
i would like to learn to do the following with this:
a function that receives an objectID for an existing object (a textfield), i would like to creat a holder div around the textfield, then add another new div after the text field so it looks like this: <div id="holder"><input type="text"><div id="foo"></div></div>
the 2nd thing i would like to solve has to do with functions and global variables, would this be solved with a class?
i have a set of functions that generally make a list of dynamic objects from an array, these functions use a couple of global variables, all works great as long as i have only 1 part of the page using these functions, if i need 2 parts of the page using them it all goes to hell because of the global vars now being double used...
I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!