Click to See Complete Forum and Search --> : document.write & layers
wilcoxsonc
12-23-2002, 04:27 PM
I found a script that creates drop down menus inside of layers. I would like to make the menu a separate file (so it's easier to change later). I have a very basic understanding of Javascript, is it possible to write the layer in an external Javascript file rather than each page of my site?
Thanks
Chris
Sure, you can:
your external js file:
document.write('<div id="someID" class="menu"></div>');
to position the layer you can use the style attribute or use an external CSS.
wilcoxsonc
01-07-2003, 04:55 PM
Ok, I've gotten the div menu to write into the window, but I can't seem to get the drop menu function to work. Its supposed to start at 100 pixels high, and on mouse over, it increases to 650 pixels high. What am I doing wrong here?
Here's what I have saved in my extrenal script file:
<!-- Hide script from older browsers
// big() makes selected layer longer (height property)
function big(lyr) {
document.all[lyr].style.height='650px'; }
/* small() makes selected layer shorter (height property)*/
function small(lyr) {
document.all[lyr].style.height='100px';
}
/* start() makes all layers short to start with (height property)*/
function start() {
document.all.Evangelism.style.height='100px';
document.all.Discipleship.style.height='100px';
document.all.Fellowship.style.height='100px';
document.all.Ministry.style.height='100px';
document.all.Worship.style.height='100px';
}
document.write("<div id='Evangelism' style='position:absolute; width:265px; height:650px; z-index:6; left: 75px; top: 30px; border: 1px none #000000; overflow: hidden; background-color: #000000; layer-background-color: #000000'; onMouseOver='big('Evangelism')'; onMouseOut='small('Evangelism')'><div align='center'><font weight='bold' face='Times New Roman' color='#FF9900' size='+4'><strong>Evangelism</strong></font></div><br /><br /><br /><div align='center'><strong><a href='./../missions.htm'><font face='Times New Roman' size='+3'>Missions</font></a></strong> </div><div align='left'><ul><ul><li><a href='../../casas.htm'><strong><font size='4'>Casas por Cristo</font></strong></a></li><li><strong><font size='4'><a href='../../missionaries.htm'>Missionaries</a></font></strong></li><li><strong><font size='4'><a href='../../missionfinder.htm'>MissionFinder</a></font></strong></li></ul></ul></div><p align='center'></p><div align='center'><strong><a href='http://www.cvcspectacular.com' target='_blank'><font face='Times New Roman' size='+3'>Christmas Spectacular</font></a></strong></div><div align='left'><ul><ul><li><strong><font size='4'><a href='http://www.cvcspectacular.com/index.htm' target='_blank'>Info</a></font></strong></li><li><strong><font size='4'><a href='../../tickets.htm'>Buy Tickets</a></font></strong></li></ul></ul></div><p align='center'></p><div align='center'><strong><a href='http://www.cravingworship.com' target='_blank'><font face='Times New Roman' size='+3'>CRAVE Worship</font></a></strong></div><p align='center'></p><div align='center'><strong><a href='../../concertinfo.htm'><font face='Times New Roman' size='+3'>Concerts</font></a></strong> </div><div align='left'><ul><ul><li><strong><font size='4'><a href='../../concertinfo.htm'>Calender</a></font></strong></li><li><strong><font size='4'><a href='../../tickets.htm'>Buy Tickets</a></font></strong></li></ul></ul></div></div>")
//-- !>
Any help would greatly appreciated!
Thanks
Chris