473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

default layer selected?

I'm using the script below to show/hide layers and I'm wondering how to make
one layer display be default. Is there a way to make layer 0 display (or any
layer) when the page loads? Thanks for any tips you can provide!

TIA - Rob

<script language="javascript">
<!--
var currDivObj = null;
function changeDIV(selObj) {
var divObj;
selValue = selObj.options[selObj.selectedIndex].value;
if (document.getElementById)
divObj = document.getElementById("div" + selValue);
else if(document.all)
divObj = document.all("div" + selValue);
else if (document.layers)
divObj = document.layers["div" + selValue];

if(document.getElementById || document.all){
if(currDivObj){
currDivObj.style.display = "none";
}
divObj.style.display = "block";
}
else if (document.layers) {
if(currDivObj){
currDivObj.visibility = "hidden";
}
divObj.visibility = "visible";
}
currDivObj = divObj;
}
// -->
</script>

<select name="sel1" onChange="changeDIV(this)" class="formField">
<option value="0">General Contact</option>
<option value="1">Wealth Management</option>
<option value="2">Business Electronic Services</option>
<option value="3">Business Services</option>
<option value="4">Check Card Request</option>
<option value="5">Club 50</option>
<option value="6">Club 50 Trip Sign-Up</option>
<option value="7">EIU Transfer Questions</option>
<option value="8">Lending</option>
<option value="9">Online Services</option>
<option value="10">Panther Card Request</option>
<option value="11">Personal Banking Services</option>
</select>
Jul 23 '05 #1
1 1307


Rob Wahmann wrote:
I'm using the script below to show/hide layers and I'm wondering how to make
one layer display be default. Is there a way to make layer 0 display (or any
layer) when the page loads? Thanks for any tips you can provide!


Unless you want to build a page that depends on scripting to work you
should start with having all layers visible in your static HTML/CSS and
then you need to run through them to hide all but one with your script.
Loop through your select (or with the values you have simply through 0
to select.options.length - 1) and hide the elements.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
22
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on...
1
by: altergothen | last post by:
Hi there, How to get DIV to work like LAYER? How can I get the following script to work? I am trying to get text to appear in a div tag as a result of the selection a dropdown list. I have...
0
by: enrico sabbadin | last post by:
Hi, A doc about a set of components I named as "Business Layer and Data Layer application blocks" is available at...
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
1
by: Mark Baldwin | last post by:
Steven Thanks for your reply, however the typed datasets are defined in the web service and there seems to way to open the partial class code window - double clicking on the design surface does...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.