Link to home
Start Free TrialLog in
Avatar of jeremyBass26
jeremyBass26Flag for United States of America

asked on

Get Div id

Hello, I am wanting to read this div

<div id="image-switch" class="image-switch">
<div style="line-height:13px; font-size:16px; vertical-align:top;">
<div id="Blank"></div>
   <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
    <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>
   </div></div></div><div style="clear:right;"></div>


and pull out the ids so that it can be writen at the top... and one know how to fix this... I have it working in another area but it was reading a form... and now that i'm try to make it read a div it is not functioning any more... thanks for the help on this...
jeremyBass

full page

look for <!--BO////////////////////////////////// area One -->
<!--BO////////////////////////////////// area Two -->
(I posted the whole thing so a solution wouldn't conflict with the rest of the stuff)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="/Core/modules/Album/css/stylesheet.css" />
<title>St. Joseph Regional Medical Center - Anesthesiology &#124 Lewiston Idaho</title>
<base href="/Core/" />
<meta name="Generator" content="St. Joseph Regional Medical Center- People Committed to Life" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content=" 
 
 
      Larry Davis, M.D.  
      Thomas J. Grissom, M.D.  
   
 
 
 ">
<meta name="keywords"
      content="best hospitals, Anesthesiology, Cardiology, Dentistry, Dermatology, Emergency Medicine, Family Practice, Gastroenterology, Hospitalist, Internal Medicine, Nephrology, Neurology, Neurosurgery, OB/GYN, Oncology, Opthamology, Oral Surgery, Orthopedics, Otolaryngology, Pathology, Pediatrics, Plastic Surgery, Psychiatry, Pulmonology, Radiology, Surgery, Surgical Assistant, Urology, Wound Care, Lewiston, Idaho, Washington, Clarkston, Regional Medical Center, Medical Center, St. Joseph, Doctors">
<meta name="robots" content="FOLLOW,INDEX"/>
<meta name="revisit-after" content="30 DAYS"/>
<script type="text/javascript" src="/Core/Scripts/MenuSystem/fsmenu.js"></script>
<!-- Demo CSS layouts for the list menu. Pick your favourite one and customise! -->
<!-- Remove all but one and change "alternate stylesheet" to "stylesheet" to enable -->
<link rel="stylesheet" type="text/css" id="listmenu-o"
  href="/Core/Scripts/MenuSystem/listmenu_o.css" title="Vertical 'Office'" />
<link rel="alternate stylesheet" type="text/css" id="listmenu-v"
  href="/Core/Scripts/MenuSystem/listmenu_v.css" title="Vertical 'Earth'" />
<link rel="alternate stylesheet" type="text/css" id="listmenu-h"
  href="/Core/Scripts/MenuSystem/listmenu_h.css" title="Horizontal 'Earth'" />
<!-- Fallback CSS menu file allows list menu operation when JS is disabled. -->
<!-- This is automatically disabled via its ID when the script kicks in. -->
<link rel="stylesheet" type="text/css" id="fsmenu-fallback"
  href="/Core/Scripts/MenuSystem/listmenu_fallback.css" />
<script language="JavaScript"  type="text/javascript">
<!--
function toggleDiv(divid){
    var prefix = '';
    if (window.event.ctrlKey) {
         document.test.control.value = 'true';
	}else{
         if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
      document.pageLoading.TCallLabel('/','restart_function');
          }else{
      document.getElementById(divid).style.display = 'none';
    }
	}
  document.test.key.value = window.event.keyCode;
}
//-->
 
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, ',type=fullWindow,fullscreen,menubar=yes,scrollbars=yes');
return false;
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function P7_MinMaxW(a,b){var nw="auto",w=document.documentElement.clientWidth;if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;}
//-->
</script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper2 {width:expression(P7_MinMaxW(800,1000));}
#container {height: 1%;}
</style>
<![endif]-->
<script src="Scripts/AC_RunActiveContent.js" language="JavaScript" type="text/JavaScript"></script>
 
 
 
 
 
 
<!--BO////////////////////////////////// area One -->
<!--BO////////////////////////////////// area One -->
<!--BO////////////////////////////////// area One -->
<!--BO////////////////////////////////// area One -->
<script language="JavaScript"  type="text/javascript">
<!--
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
 
//-->
</script>
<style type="text/css">
<!--
#image-switch div {
	float:right;
}
#image-switch ul {
	margin:0 0 0 20px;
	color:red;
	list-style-type:none;
}
#image-switch li {
	padding:10px;
}
-->
</style>
<script type="text/javascript"><!-- 
document.write("<style type=\"text/css\">");
for(var i=0; i<option.length; i++) 
document.write("#", option[i], ",");
}
document.write("#", "Blank");
 
document.write("{");
document.write("display:none;");
document.write("}");
document.write("-->");
document.write("</style>");
//--></script>
 
<!--EO////////////////////////////////// area One -->
<!--EO////////////////////////////////// area One -->
<!--EO////////////////////////////////// area One -->
<!--EO////////////////////////////////// area One -->
 
 
<link rel="stylesheet" type="text/css" media="screen" href="/Core/stylesheet.php?templateid=20&amp;mediatype=screen" />
<link rel="stylesheet" type="text/css" media="print" href="/Core/stylesheet.php?templateid=20&amp;mediatype=print" />
<link rel="start" title="We at St. Joseph Regional Medical Center strive to stay on top of the newest tools to help you reach your peak health.  What is one of our newest tools?  You're looking at it.  This new website will keep you and our doctors closer then ever." href="/Core/" />
<link rel="prev" title="Find a Doctor" href="/Core/DoctorDirectory" />
<link rel="next" title="LarryDavis" href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/Core/News/rss/" />
</head>
<body>
<table id="maintable" cellspacing="0" cellpadding="0">
  <tr>
    <td id="leftGRD"></td>
    <td id="pagewrapper"><div id="pagewrapper2">
        <ul class="accessibility">
          <li><a href="/Core/DoctorDirectory/Anesthesiology#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
          <li><a href="/Core/DoctorDirectory/Anesthesiology#main" title="Skip to content" accesskey="s">Skip to content</a></li>
        </ul>
        <hr class="accessibility" />
        <div id="header">
          <h1><a href="/Core/" title="We at St. Joseph Regional Medical Center strive to stay on top of the newest tools to help you reach your peak health.  What is one of our newest tools?  You're looking at it.  This new website will keep you and our doctors closer then ever.">St. Joseph Regional Medical Center</a></h1>
          <hr class="accessibility" />
        </div>
        <div id="midHeader" style="z-index: -1000">
          <div id="hideMe4" style="
	z-index: -1000;
	display: '';
">
            <script type="text/javascript">
AC_FL_RunContent( 'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','775','height','197','title','Header','src','/Core_images/elements/Test resize','quality','high','pluginspage', 'https://www.macromedia.com/go/getflashplayer','movie','/Core_images/elements/Test resize' );
 //end AC code
</script>
            <noscript>
            <object type="application/x-shockwave-flash"
data="c.swf?path=/Core_images/elements/Test resize.swf" 
width="775" height="197">
              <param name="movie" 
value="c.swf?path=/Core_images/elements/Test resize.swf" />
            </object>
            </noscript>
          </div>
        </div>
        <div id="search">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><div class="login_OUT"><a href="my-account/login/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Account&nbsp;&frasl;&nbsp;</a><a href="/Core/my-account/login" title="My Account">login</a>&nbsp;|</div></td>
              <td><form id="cntnt01moduleform_1" method="get" action="index.php">
                  <div class="hidden">
                    <input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" />
                    <input type="hidden" name="cntnt01returnid" value="125" />
                  </div>
                  <label for="cntnt01searchinput">Search</label>
                  :&nbsp;
                  <input type="text" name="cntnt01searchinput" size="20" maxlength="50" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"/>
                  <input name="submit" value="Submit" type="submit" onMouseDown="javascript:toggleDiv('hideMe3')"/>
                </form></td>
            </tr>
          </table>
        </div>
        <div class="breadcrumbs"> You are here: <a href="/Core/DoctorDirectory">Find a Doctor</a> » <span class="lastitem">Anesthesiology</span>
          <hr class="accessibility" />
        </div>
        <div id="content">
          <div id="sidebar">
            <div id="menu_vert">
              <ul class="menulist" id="listMenuRoot">
                <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/" accesskey="1" ><dfn>1: </dfn>St. Joseph Home</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services" ><dfn>2: </dfn>Services</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/auxiliary-volunteer" ><dfn>2.1: </dfn>Auxiliary Volunteer</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/regional-cancer-center" ><dfn>2.2: </dfn>Regional Cancer Center</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC" ><dfn>2.3: </dfn>Resource Center</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/cpr" ><dfn>2.3.1: </dfn>CPR</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/first-aid" ><dfn>2.3.2: </dfn>First Aid</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/family-beginnings-classes" ><dfn>2.3.3: </dfn>Family Beginnings Classes</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/diabetes-center-education" ><dfn>2.3.4: </dfn>Diabetes Center-Education</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/tobacco-free-you" ><dfn>2.3.5: </dfn>Tobacco Free You</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/nutrition-education" ><dfn>2.3.6: </dfn>Nutrition Education</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/services/CHERC/wound-and-ostomy-education" ><dfn>2.3.7: </dfn>Wound and Ostomy Education</a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/staff-content/health-news"  target="_self"><dfn>2.5: </dfn>Health News</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings" ><dfn>3: </dfn>Family Beginnings</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/family-beginnings/classes-groups" ><dfn>3.1: </dfn>Classes and Groups</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings/newborns" ><dfn>3.2: </dfn>Newborns</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/family-beginnings/newborns/2007-2" ><dfn>3.2.1: </dfn>2007</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/family-beginnings/newborns/2008-2" ><dfn>3.2.2: </dfn>2008</a> </li>
                      </ul>
                    </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/events-calendar" ><dfn>4: </dfn>Events Calendar</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/events-calendar/today-at-st-joe-s" ><dfn>4.1: </dfn>Today at St. Joe&#39;s</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph" ><dfn>5: </dfn>About St. Joseph</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/about-st-joseph/contact-st-joseph" ><dfn>5.1: </dfn>Contact St. Joseph</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/about-st-joseph/accreditations" ><dfn>5.2: </dfn>Accreditations</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/about-st-joseph/publications" ><dfn>5.3: </dfn>Publications</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/about-st-joseph/news" ><dfn>5.4: </dfn>News</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/about-st-joseph/awards" ><dfn>5.5: </dfn>Awards</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/foundation" ><dfn>6: </dfn>Foundation</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/foundation/board-members" ><dfn>6.1: </dfn>Board Members</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/foundation/foundation-projects" ><dfn>6.2: </dfn>CENTURY CLUB</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/foundation/foundation-projects-2" ><dfn>6.3: </dfn>Foundation Projects</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/gift-shop" ><dfn>7: </dfn>Gift Shop</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/employment-opportunities" ><dfn>8: </dfn>Employment Opportunities</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory" ><dfn>10: </dfn>Find a Doctor</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/Anesthesiology" ><dfn>10.1: </dfn>Anesthesiology</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" ><dfn>10.1.1: </dfn>Larry Davis, M.D.</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" ><dfn>10.1.2: </dfn>Thomas J. Grissom, M.D.</a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/cardiology" ><dfn>10.2: </dfn>Cardiology</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/cardiology/lee-gould-m-d" ><dfn>10.2.1: </dfn>Lee Gould, M.D. </a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/dentistry" ><dfn>10.3: </dfn>Dentistry</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/dermatology" ><dfn>10.4: </dfn>Dermatology</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="/Core/DoctorDirectory/emergency-medicine" ><dfn>10.5: </dfn>Emergency Medicine</a> </li>
                  </ul>
                </li>
              </ul>
              <script type="text/javascript">
//<![CDATA[
 
 
var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
 
 
listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;
listMenu.animations[listMenu.animations.length] = FSMenu.animClipDown;
 
 
var arrow = null;
if (document.createElement && document.documentElement)
{
 arrow = document.createElement('span');
 arrow.appendChild(document.createTextNode('>'));
 // Feel free to replace the above two lines with these for a small arrow image...
 //arrow = document.createElement('img');
 //arrow.src = 'arrow.gif';
 //arrow.style.borderWidth = '0';
 arrow.className = 'subind';
}
addEvent(window, 'load', new Function('listMenu.activateMenu("listMenuRoot", arrow)'));
 
 
// You may wish to leave your menu as a visible list initially, then apply its style
// dynamically on activation for better accessibility. Screenreaders and older browsers will
// then see all your menu data, but there will be a 'flicker' of the raw list before the
// page has completely loaded. If you want to do this, remove the CLASS="..." attribute from
// the above outermost UL tag, and uncomment this line:
//addEvent(window, 'load', new Function('getRef("listMenuRoot").className="menulist"'));
 
//]]>
</script>
              <h2 class="accessibility">Navigation</h2>
            </div>
            <div id="news">
              <h2><a href="/Core/about-st-joseph/news" onMouseDown="javascript:toggleDiv('hideMe3')">News</a></h2>
              <!-- Displaying News Module -->
              <!-- News Categories: '' -->
              <!-- Start News Display Template -->
              <div class="NewsSummary">
                <div class="NewsSummaryPostdate">05/30/2008</div>
                <div class="NewsSummaryLink"><a href="/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">Brenda McIntosh 2008 Employee of the Year</a></div>
                <div class="NewsSummaryCategory">Category: Employee News</div>
                <!--<div class="NewsSummaryAuthor">Posted by: StjoeAdmin</div>-->
                <div class="NewsSummarySummary">Brenda McIntosh, a 24-year employee of St. Joseph Regional Medical Center, has been selected as the 2008 Employee of the Year in recognition of her many contributions.</div>
                <div class="NewsSummaryMorelink" onMouseDown="javascript:toggleDiv('hideMe3')"><span style="float:left; line-height:13px;">[<a href="/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">More</a>]</span><span style="float:right; line-height:13px;"><a href="/Core/about-st-joseph/news">&#91;Browse&#93;</a></span><br/>
                </div>
              </div>
              <!-- End News Display Template -->
            </div>
            <div style="text-align:left;" > <a href="../pacs.html" onclick="return popup(this,'bigwindow')" ><img border="0" width="204" src="../pacs.png" height="38" alt="PACS Link"/></a> </div>
            <div style="text-align:right;" > <br/>
              <a href="/Core/staff-content/health-news"><img src="/St_Joe_Core/images/icon-healthday-box.gif" alt="Health Day" width="200" height="157" border="0" style="margin-left:10px;"></a><br/>
              <br/>
              <a target="_self" href="/Core/services/CHERC/"><img border="0" width="180" src="/St_Joe_Core/images/cherc_DB_flat.png" alt="Community Health Education Resource Center" height="63" /></a> <br/>
              <br/>
              <a target="_self" href="/Core/foundation" onmousedown="javascript:toggleDiv('hideMe3')"><img border="0" width="180" src="/St_Joe_Core/images/logo_foundation.gif" alt="St. Joseph Regional Medical Center Foundation" height="50" /></a> <br/>
              <a target="_blank" href="http://www.ascensionhealth.org/"><img border="0" width="160" src="../images/logo_ascension_health.gif" alt="Ascension Health" height="73" /></a> <br/>
              <br/>
            </div>
          </div>
          <div id="main">
            <div style="float: right;"><a href="help" target="_self" onmousedown="javascript:toggleDiv('hideMe3')"><img src="images/cms/help.gif" alt="Help" width="28" height="28" border="0"/></a><a href='/Core/index.php?mact=Printing,m5,printpage,1&amp;m5showbutton=1&amp;m5script=1&amp;m5returnid=125&amp;page=125' class='noprint'  > <img src='modules/Printing/printbutton.png' alt='Print this page' /> </a> </div>
            <h2>Anesthesiology</h2>
            <div class="category_items">
              <ul id="CHERClist" style="line-height:13px; font-size:16px; vertical-align:top; float:left;">
                <li><a href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" onmouseover="switch1('LarryDavis_f_1_400_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Larry Davis, M.D.</a></li>
                <li><a href="/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" onmouseover="switch1('anesthesiology_ct_1_90_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Thomas J. Grissom, M.D.</a></li>
              </ul>
              
              <!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
              
              
              <div id="image-switch" class="image-switch">
                <div style="line-height:13px; font-size:16px; vertical-align:top;">
                  <div id="Blank"></div>
                  <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
                  <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>
                </div>
              </div>
            </div>
            <div style="clear:right;"></div>
            <script type="text/javascript">
var option = new Array ();
var x= document.obj.getElementById("image-switch");
for (var i=0;i<x.length;i++)
{	
option.push(x.obj[i].id);
}</script>
 
 <!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
 
            <br />
            <div class="hr">
              <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Qiuck Contact List">
                <tr>
                  <td align="right"><span style="color:#00194d;font-weight: bold;"><a href="about-st-joseph/contact-st-joseph/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Contact Us</a> &bull; <a href="find-a-doctor/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Find A Doctor</a> &bull; <a href="services/CHERC/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Join A Class</a></span></td>
                </tr>
              </table>
            </div>
            <div>
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="9px"><img src="images/Aceess_Link_left.gif" width="9" height="51" alt=" "/></td>
                  <td class="AccessLink"><span class="AccessLinktitle" >Accessibility  links</span><br/>
                    <span class="AccessLinks" >Previous page: <a href="/Core/DoctorDirectory" title="Find a Doctor">Find a Doctor</a><br/>
                    Next page: <a href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" title="LarryDavis">Larry Davis, M.D.</a></span> </td>
                  <td width="41px"><img src="images/Aceess_Link_right.gif" width="41" height="51" alt=" "/></td>
                </tr>
              </table>
            </div>
            <hr class="accessibility" />
          </div>
        </div>
        <div id="footer"> <br/>
          This site was Created by <a href="http://digitalbarn.tv/"><font color="#ffffff"><font color="#ff0000">d</font>igital <font color="#ff0000">b</font>arn productions</font></a><br/>
          Managed by
          <script type="text/javascript"><!-- 
document.write("<a ", "href=\"", "&#109;a&#105;&#108;", "t&#111;", ":","dbjeremy", "&#64;","cableone.net","?subject=","From St joe", "\"><font style=\"","color:#ffffff","\">","Jeremy Bass","</", "font>", "</", "a>");
//--></script>
          <br/>
          <br/>
        </div>
        <div id="hideMe3" style="
display: none;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
">
          <script type="text/javascript"> 
AC_FL_RunContent( 'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','362','height','35','title','Header','src','/Core/elements/pageLoading','wmode', 'transparent','quality','high','pluginspage', 'https://www.macromedia.com/go/getflashplayer','movie','/Core/elements/pageLoading' ); 
//end AC code
</script>
          <noscript>
          <object type="application/x-shockwave-flash"
data="c.swf?path=/Core/elements/pageLoading.swf" 
width="362" height="35">
            <param name="wmode" value="transparent" />
            <param name="movie" 
value="c.swf?path=/Core/elements/pageLoading.swf" />
          </object>
          </noscript>
        </div>
      </div></td>
    <td id="rightGRD"></td>
  </tr>
</table>
</body>
</html>
<!-- 1.618303 / 129 -->

Open in new window

Avatar of jeremyBass26
jeremyBass26
Flag of United States of America image

ASKER

here is an example of the work switch code which is what i'm trying to write dynamicly.... thanks again... :)
{literal}<script language="JavaScript"  type="text/javascript">
<!--
function switch1(div) {
if (document.getElementById('Anesthesiology')) {
var option=['Anesthesiology','Cardiology','Dentistry','Dermatology','EmergencyMedicine'];
for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["Anesthesiology"].src = i;
}
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
#Cardiology,#Dentistry,#Dermatology,#EmergencyMedicine{
display:none;
}
-->
</style>
{/literal}

Open in new window

Hello

here is a small example which will giev you direction..

copy paste this script in a page and see what it do..

neeraj523
<div id="div1">1
	<div id="div2">2</div>
	</div>
<div id="div3">3</div>
 
<SCRIPT Language="JAVASCRIPT">
		for(i=0; i< document.all.length; i ++)
		{
			if(document.all[i].id.indexOf("div") >= 0)
			{
				alert(document.all[i].innerText)
			}
		}
</SCRIPT>

Open in new window

Avatar of HonorGod
A better solution
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> DIV IDs </title>
<script type='text/javascript'>
  function ids() {
    var divs = document.getElementsByTagName( 'DIV' );
    alert( '# divs: ' + divs.length );
    var debug = document.getElementById( 'debug' );
    if ( debug ) {
      var msg = '';
      for ( var i = 0; i < divs.length; i++ ) {
        var id = divs[ i ].getAttribute( 'id' );
        if ( id && id != 'debug' ) {
          msg += id + '<br>';
        }
      }
      if ( msg != '' ) {
        debug.innerHTML = 'DIV ID list:<br>' + msg;
      }
    }
  }
</script>
</head>
<body onload='ids()'>
<table id="maintable" cellspacing="0" cellpadding="0">
  <tr>
    <td id="leftGRD"></td>
    <td id="pagewrapper"><div id="pagewrapper2">
        <ul class="accessibility">
          <li><a href="/Core/DoctorDirectory/Anesthesiology#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
          <li><a href="/Core/DoctorDirectory/Anesthesiology#main" title="Skip to content" accesskey="s">Skip to content</a></li>
        </ul>
        <hr class="accessibility" />
        <div id="header">
          <h1><a href="/Core/" title="We at St. Joseph Regional Medical Center strive to stay on top of the newest tools to help you reach your peak health.  What is one of our newest tools?  You're looking at it.  This new website will keep you and our doctors closer then ever.">St. Joseph Regional Medical Center</a></h1>
          <hr class="accessibility" />
        </div>
        <div id="midHeader" style="z-index: -1000">
          <div id="hideMe4" style="
	z-index: -1000;
	display: '';
">
          </div>
        </div>
        <div id="search">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><div class="login_OUT"><a href="my-account/login/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Account&nbsp;&frasl;&nbsp;</a><a href="/Core/my-account/login" title="My Account">login</a>&nbsp;|</div></td>
              <td><form id="cntnt01moduleform_1" method="get" action="index.php">
                  <div class="hidden">
                    <input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" />
                    <input type="hidden" name="cntnt01returnid" value="125" />
                  </div>
                  <label for="cntnt01searchinput">Search</label>
                  :&nbsp;
                  <input type="text" name="cntnt01searchinput" size="20" maxlength="50" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"/>
                  <input name="submit" value="Submit" type="submit" onMouseDown="javascript:toggleDiv('hideMe3')"/>
                </form></td>
            </tr>
          </table>
        </div>
        <div class="breadcrumbs"> You are here: <a href="/Core/DoctorDirectory">Find a Doctor</a> » <span class="lastitem">Anesthesiology</span>
          <hr class="accessibility" />
        </div>
        <div id="content">
          <div id="sidebar">
            <div id="menu_vert">
              <ul class="menulist" id="listMenuRoot">
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/" accesskey="1" ><dfn>1: </dfn>St. Joseph Home</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services" ><dfn>2: </dfn>Services</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/auxiliary-volunteer" ><dfn>2.1: </dfn>Auxiliary Volunteer</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/regional-cancer-center" ><dfn>2.2: </dfn>Regional Cancer Center</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC" ><dfn>2.3: </dfn>Resource Center</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/cpr" ><dfn>2.3.1: </dfn>CPR</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/first-aid" ><dfn>2.3.2: </dfn>First Aid</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/family-beginnings-classes" ><dfn>2.3.3: </dfn>Family Beginnings Classes</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/diabetes-center-education" ><dfn>2.3.4: </dfn>Diabetes Center-Education</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/tobacco-free-you" ><dfn>2.3.5: </dfn>Tobacco Free You</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/nutrition-education" ><dfn>2.3.6: </dfn>Nutrition Education</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/services/CHERC/wound-and-ostomy-education" ><dfn>2.3.7: </dfn>Wound and Ostomy Education</a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/staff-content/health-news"  target="_self"><dfn>2.5: </dfn>Health News</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings" ><dfn>3: </dfn>Family Beginnings</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings/classes-groups" ><dfn>3.1: </dfn>Classes and Groups</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings/newborns" ><dfn>3.2: </dfn>Newborns</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings/newborns/2007-2" ><dfn>3.2.1: </dfn>2007</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/family-beginnings/newborns/2008-2" ><dfn>3.2.2: </dfn>2008</a> </li>
                      </ul>
                    </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/events-calendar" ><dfn>4: </dfn>Events Calendar</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/events-calendar/today-at-st-joe-s" ><dfn>4.1: </dfn>Today at St. Joe&#39;s</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph" ><dfn>5: </dfn>About St. Joseph</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph/contact-st-joseph" ><dfn>5.1: </dfn>Contact St. Joseph</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph/accreditations" ><dfn>5.2: </dfn>Accreditations</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph/publications" ><dfn>5.3: </dfn>Publications</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph/news" ><dfn>5.4: </dfn>News</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/about-st-joseph/awards" ><dfn>5.5: </dfn>Awards</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/foundation" ><dfn>6: </dfn>Foundation</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/foundation/board-members" ><dfn>6.1: </dfn>Board Members</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/foundation/foundation-projects" ><dfn>6.2: </dfn>CENTURY CLUB</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/foundation/foundation-projects-2" ><dfn>6.3: </dfn>Foundation Projects</a> </li>
                  </ul>
                </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/gift-shop" ><dfn>7: </dfn>Gift Shop</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/employment-opportunities" ><dfn>8: </dfn>Employment Opportunities</a> </li>
                <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory" ><dfn>10: </dfn>Find a Doctor</a>
                  <ul>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/Anesthesiology" ><dfn>10.1: </dfn>Anesthesiology</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" ><dfn>10.1.1: </dfn>Larry Davis, M.D.</a> </li>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" ><dfn>10.1.2: </dfn>Thomas J. Grissom, M.D.</a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/cardiology" ><dfn>10.2: </dfn>Cardiology</a>
                      <ul>
                        <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/cardiology/lee-gould-m-d" ><dfn>10.2.1: </dfn>Lee Gould, M.D. </a> </li>
                      </ul>
                    </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/dentistry" ><dfn>10.3: </dfn>Dentistry</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/dermatology" ><dfn>10.4: </dfn>Dermatology</a> </li>
                    <li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="/Core/DoctorDirectory/emergency-medicine" ><dfn>10.5: </dfn>Emergency Medicine</a> </li>
                  </ul>
                </li>
              </ul>
              <h2 class="accessibility">Navigation</h2>
            </div>
            <div id="news">
              <h2><a href="/Core/about-st-joseph/news" onMouseDown="javascript:toggleDiv('hideMe3')">News</a></h2>
              <!-- Displaying News Module -->
              <!-- News Categories: '' -->
              <!-- Start News Display Template -->
              <div class="NewsSummary">
                <div class="NewsSummaryPostdate">05/30/2008</div>
                <div class="NewsSummaryLink"><a href="/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">Brenda McIntosh 2008 Employee of the Year</a></div>
                <div class="NewsSummaryCategory">Category: Employee News</div>
                <!--<div class="NewsSummaryAuthor">Posted by: StjoeAdmin</div>-->
                <div class="NewsSummarySummary">Brenda McIntosh, a 24-year employee of St. Joseph Regional Medical Center, has been selected as the 2008 Employee of the Year in recognition of her many contributions.</div>
                <div class="NewsSummaryMorelink" onMouseDown="javascript:toggleDiv('hideMe3')"><span style="float:left; line-height:13px;">[<a href="/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">More</a>]</span><span style="float:right; line-height:13px;"><a href="/Core/about-st-joseph/news">&#91;Browse&#93;</a></span><br/>
                </div>
              </div>
              <!-- End News Display Template -->
            </div>
            <div style="text-align:left;" > <a href="../pacs.html" onclick="return popup(this,'bigwindow')" ><img border="0" width="204" src="../pacs.png" height="38" alt="PACS Link"/></a> </div>
            <div style="text-align:right;" > <br/>
              <a href="/Core/staff-content/health-news"><img src="/St_Joe_Core/images/icon-healthday-box.gif" alt="Health Day" width="200" height="157" border="0" style="margin-left:10px;"></a><br/>
              <br/>
              <a target="_self" href="/Core/services/CHERC/"><img border="0" width="180" src="/St_Joe_Core/images/cherc_DB_flat.png" alt="Community Health Education Resource Center" height="63" /></a> <br/>
              <br/>
              <a target="_self" href="/Core/foundation" onmousedown="javascript:toggleDiv('hideMe3')"><img border="0" width="180" src="/St_Joe_Core/images/logo_foundation.gif" alt="St. Joseph Regional Medical Center Foundation" height="50" /></a> <br/>
              <a target="_blank" href="http://www.ascensionhealth.org/"><img border="0" width="160" src="../images/logo_ascension_health.gif" alt="Ascension Health" height="73" /></a> <br/>
              <br/>
            </div>
          </div>
          <div id="main">
            <div style="float: right;"><a href="help" target="_self" onmousedown="javascript:toggleDiv('hideMe3')"><img src="images/cms/help.gif" alt="Help" width="28" height="28" border="0"/></a><a href='/Core/index.php?mact=Printing,m5,printpage,1&amp;m5showbutton=1&amp;m5script=1&amp;m5returnid=125&amp;page=125' class='noprint'  > <img src='modules/Printing/printbutton.png' alt='Print this page' /> </a> </div>
            <h2>Anesthesiology</h2>
            <div class="category_items">
              <ul id="CHERClist" style="line-height:13px; font-size:16px; vertical-align:top; float:left;">
                <li><a href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" onmouseover="switch1('LarryDavis_f_1_400_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Larry Davis, M.D.</a></li>
                <li><a href="/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" onmouseover="switch1('anesthesiology_ct_1_90_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Thomas J. Grissom, M.D.</a></li>
              </ul>
 
              <!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
<!--BO////////////////////////////////// area Two -->
 
 
              <div id="image-switch" class="image-switch">
                <div style="line-height:13px; font-size:16px; vertical-align:top;">
                  <div id="Blank"></div>
                  <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
                  <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>
                </div>
              </div>
            </div>
            <div style="clear:right;"></div>
 <!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
<!--EO////////////////////////////////// area Two -->
 
            <br />
            <div class="hr">
              <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Qiuck Contact List">
                <tr>
                  <td align="right"><span style="color:#00194d;font-weight: bold;"><a href="about-st-joseph/contact-st-joseph/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Contact Us</a> &bull; <a href="find-a-doctor/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Find A Doctor</a> &bull; <a href="services/CHERC/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Join A Class</a></span></td>
                </tr>
              </table>
            </div>
            <div>
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="9px"><img src="images/Aceess_Link_left.gif" width="9" height="51" alt=" "/></td>
                  <td class="AccessLink"><span class="AccessLinktitle" >Accessibility  links</span><br/>
                    <span class="AccessLinks" >Previous page: <a href="/Core/DoctorDirectory" title="Find a Doctor">Find a Doctor</a><br/>
                    Next page: <a href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" title="LarryDavis">Larry Davis, M.D.</a></span> </td>
                  <td width="41px"><img src="images/Aceess_Link_right.gif" width="41" height="51" alt=" "/></td>
                </tr>
              </table>
            </div>
            <hr class="accessibility" />
          </div>
        </div>
        <div id="footer"> <br/>
          This site was Created by <a href="http://digitalbarn.tv/"><font color="#ffffff"><font color="#ff0000">d</font>igital <font color="#ff0000">b</font>arn productions</font></a><br/>
          Managed by
          <br/>
          <br/>
        </div>
        <div id="hideMe3" style="
display: none;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
">
        </div>
      </div></td>
    <td id="rightGRD"></td>
  </tr>
</table>
<div id='debug'></div>
</body>
</html>

Open in new window

Scroll to the bottom of the page, and you'll see the list of DIV IDs
HonorGod  your solution seems to be more in line with what i'm aimming after... but it's a little to broad.... how do i get just the three?

I need to target only the divs in image-switch

Blank           <<<<<<<<<<< traget rather skip this....
LarryDavis_f_1_400_1           <<<<<<<<<<< traget
anesthesiology_ct_1_90_1       <<<<<<<<<<< traget


"
DIV ID list:
pagewrapper2
header
midHeader
hideMe4
search
content
sidebar
menu_vert
news
main
image-switch
Blank           <<<<<<<<<<< traget
LarryDavis_f_1_400_1           <<<<<<<<<<< traget
anesthesiology_ct_1_90_1           <<<<<<<<<<< traget
footer
hideMe3
"


I can't add <body onload='ids()'>
so i  did window.onload=ids;
and took out the reader at the bottom...


over all I think this is the right track... the switcher need to be accounted for na dmy trs failed there.. :P well thank you for helping... i know we are close... Have a great one and look forward to hear back soon  :D
{literal}
<script type='text/javascript'>
window.onload=ids;
  function ids() {
    var divs = document.getElementsByTagName( 'DIV' );
    alert( '# divs: ' + divs.length );
    var debug = document.getElementById( 'image-switch' );
    if ( debug ) {
      var msg = '';
      for ( var i = 0; i < divs.length; i++ ) {
        var id = divs[ i ].getAttribute( 'id' );
        if ( id && id != 'debug' ) {
          msg += id + '<br>';
        }
      }
      if ( msg != '' ) {
        debug.innerHTML = 'DIV ID list:<br>' + msg;
      }
    }
  }
</script>
 
 
<script language="JavaScript"  type="text/javascript">
<!--
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<option.length; i++) 
{ obj=document.getElementById(divs[i]);
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
 
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}-->
</style>
<script type="text/javascript"><!-- 
document.write("<style type=\"text/css\">");
for(var i=0; i<divs.length; i++) 
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
 
document.write("{");
document.write("display:none;");
document.write("}");
document.write("-->");
document.write("</style>");
//--></script>
{/literal}

Open in new window

It sounds like we can use something like this:



<script type='text/javascript'>
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
      var debug = document.getElementById( 'debug' );
      if ( debug ) {
        var msg = '';
        for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
          if ( id && id != 'debug' ) {
            msg += id + '<br>';
          }
        }
        if ( msg != '' ) {
          debug.innerHTML = 'DIV ID list:<br>' + msg;
        }
      }
    }
  }
</script>

Open in new window

Pimpin... That's getting closer.. I was alerted 4 divs... there is only 3 with Id's... not sure if this is and issue also

this didn't seem to work...  not to sure why...
<script type="text/javascript"><!--
document.write("<style type=\"text/css\">");
for(var i=0; i<divs.length; i++)
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
 
document.write("{");
document.write("display:none;");
document.write("}");
document.write("-->");
document.write("</style>");
//--></script>


If it helps
this is the static one....
https://www.sjrmc.org/Core/DoctorDirectory

this is the dynamic one we are working on....
https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology
I wonder if the

image_switch.getElementsByTagName( 'DIV' );

is including the "image-switch" div...

looking.
you are finding 4, because there are 4:

                <div style="line-height:13px; font-size:16px; vertical-align:top;">
                  <div id="Blank"></div>
                  <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
                  <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>
                </div>
only 3 have id's though
got yeah.... so why is

<script type="text/javascript"><!--
document.write("<style type=\"text/css\">");
for(var i=0; i<divs.length; i++)
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
 
document.write("{");
document.write("display:none;");
document.write("}");
document.write("-->");
document.write("</style>");
//--></script>

not working?  would the fact that it's pulling 4 divs?   I didn't think so as there are only 3 with id's... ???
I wonder if you could "hide" the "image-switch" div, and have everything inside it automatically hidden?

  var image_switch = document.getElementById( 'image-switch' );
  image_switch.style.display = 'none';
The alert says 4 because 4 divs exist.  The number does not represent the number
of divs with ids.

Your "for" is missing an open curly brace:

for(var i=0; i<divs.length; i++)

should be:

for(var i=0; i<divs.length; i++) {
If I'm fallowing you right... I don't think i can do that as  
<div id="Blank"></div>
                  <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
                  <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>

 only one at a time does each of these show and is triggered by the onmouseover="switch1('LarryDavis_f_1_400_1');"  (which is dynamicly created)


of
<ul id="CHERClist" style="line-height:13px; font-size:16px; vertical-align:top; float:left;">
                <li><a href="/Core/DoctorDirectory/Anesthesiology/LarryDavis" onmouseover="switch1('LarryDavis_f_1_400_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Larry Davis, M.D.</a></li>
                <li><a href="/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" onmouseover="switch1('anesthesiology_ct_1_90_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Thomas J. Grissom, M.D.</a></li>
              </ul>
ah.

Why do you (think you) need to dynamically create the style section?
because the div ids are created dynamicly... so I'd need a way to match them... and so that is way I'm off on this path... :)
ah.  Was the missing open curly brace related to your problem?
oh my oh my... so i fixed the curly brace form the post i missed... and everything is display none... :( any ideas on that?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="https://www.sjrmc.org/Core/modules/Album/css/stylesheet.css" />
<title>St. Joseph Regional Medical Center - Anesthesiology &#124 Lewiston Idaho</title>
<base href="https://www.sjrmc.org/Core/" />
<meta name="Generator" content="St. Joseph Regional Medical Center- People Committed to Life" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
<meta name="description" content=" 
 
 
      Larry Davis, M.D.  
      Thomas J. Grissom, M.D.  
   
 
 
 ">
<meta name="keywords"
      content="best hospitals, Anesthesiology, Cardiology, Dentistry, Dermatology, Emergency Medicine, Family Practice, Gastroenterology, Hospitalist, Internal Medicine, Nephrology, Neurology, Neurosurgery, OB/GYN, Oncology, Opthamology, Oral Surgery, Orthopedics, Otolaryngology, Pathology, Pediatrics, Plastic Surgery, Psychiatry, Pulmonology, Radiology, Surgery, Surgical Assistant, Urology, Wound Care, Lewiston, Idaho, Washington, Clarkston, Regional Medical Center, Medical Center, St. Joseph, Doctors">
	<meta name="robots" content="FOLLOW,INDEX"/>
	<meta name="revisit-after" content="30 DAYS"/>
 
 
 <script type="text/javascript" src="/Core/Scripts/MenuSystem/fsmenu.js"></script>
 <!-- Demo CSS layouts for the list menu. Pick your favourite one and customise! -->
 <!-- Remove all but one and change "alternate stylesheet" to "stylesheet" to enable -->
 <link rel="stylesheet" type="text/css" id="listmenu-o"
  href="/Core/Scripts/MenuSystem/listmenu_o.css" title="Vertical 'Office'" />
 <link rel="alternate stylesheet" type="text/css" id="listmenu-v"
  href="/Core/Scripts/MenuSystem/listmenu_v.css" title="Vertical 'Earth'" />
 <link rel="alternate stylesheet" type="text/css" id="listmenu-h"
  href="/Core/Scripts/MenuSystem/listmenu_h.css" title="Horizontal 'Earth'" />
 
 <!-- Fallback CSS menu file allows list menu operation when JS is disabled. -->
 <!-- This is automatically disabled via its ID when the script kicks in. -->
 <link rel="stylesheet" type="text/css" id="fsmenu-fallback"
  href="/Core/Scripts/MenuSystem/listmenu_fallback.css" />
 
<script language="JavaScript"  type="text/javascript">
<!--
function toggleDiv(divid){
    var prefix = '';
    if (window.event.ctrlKey) {
         document.test.control.value = 'true';
	}else{
         if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
      document.pageLoading.TCallLabel('/','restart_function');
          }else{
      document.getElementById(divid).style.display = 'none';
    }
	}
  document.test.key.value = window.event.keyCode;
}
//-->
 
</script>
 
 
<script language="JavaScript" type="text/JavaScript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, ',type=fullWindow,fullscreen,menubar=yes,scrollbars=yes');
return false;
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function P7_MinMaxW(a,b){var nw="auto",w=document.documentElement.clientWidth;if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;}
//-->
</script>
<!--[if lte IE 6]>
<style type="text/css">
#pagewrapper2 {width:expression(P7_MinMaxW(800,1000));}
#container {height: 1%;}
</style>
<![endif]-->
<script src="Scripts/AC_RunActiveContent.js" language="JavaScript" type="text/JavaScript"></script>
<!--[if lt IE 7]>
<script defer type="text/javascript" src="Scripts/png-fix.js"></script>
<![endif]-->
 
 
 
 
<script type='text/javascript'>
window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
      var debug = document.getElementById( 'debug' );
      if ( debug ) {
        var msg = '';
        for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
          if ( id && id != 'debug' ) {
            msg += id + '<br>';
          }
        }
        if ( msg != '' ) {
          debug.innerHTML = 'DIV ID list:<br>' + msg;
        }
      }
    }
  }
</script>
 
 
<script language="JavaScript"  type="text/javascript">
<!--
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divs.length; i++) 
{ obj=document.getElementById(divs[i]);
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
 
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}-->
</style>
<script type="text/javascript"><!-- 
document.write("<style type=\"text/css\">");
for(var i=0; i<divs.length; i++) {
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
 
document.write("{");
document.write("display:none;");
document.write("}");
document.write("-->");
document.write("</style>");
//--></script>
 
 
 
<link rel="stylesheet" type="text/css" media="screen" href="https://www.sjrmc.org/Core/stylesheet.php?templateid=20&amp;mediatype=screen" />
<link rel="stylesheet" type="text/css" media="print" href="https://www.sjrmc.org/Core/stylesheet.php?templateid=20&amp;mediatype=print" />
 
 
 
<link rel="start" title="We at St. Joseph Regional Medical Center strive to stay on top of the newest tools to help you reach your peak health.  What is one of our newest tools?  You're looking at it.  This new website will keep you and our doctors closer then ever." href="https://www.sjrmc.org/Core/" />
<link rel="prev" title="Find a Doctor" href="https://www.sjrmc.org/Core/DoctorDirectory" />
<link rel="next" title="LarryDavis" href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/LarryDavis" />
 
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="https://www.sjrmc.org/Core/News/rss/" /></head>
<body>
<table id="maintable" cellspacing="0" cellpadding="0">
  <tr>
    <td id="leftGRD"></td>
    <td id="pagewrapper">
<div id="pagewrapper2">
        <ul class="accessibility">
      <li><a href="/Core/DoctorDirectory/Anesthesiology#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
      <li><a href="/Core/DoctorDirectory/Anesthesiology#main" title="Skip to content" accesskey="s">Skip to content</a></li>
    </ul>
    
    <hr class="accessibility" />
    
      <div id="header">
           <h1><a href="https://www.sjrmc.org/Core/" title="We at St. Joseph Regional Medical Center strive to stay on top of the newest tools to help you reach your peak health.  What is one of our newest tools?  You're looking at it.  This new website will keep you and our doctors closer then ever.">St. Joseph Regional Medical Center</a></h1>
   <hr class="accessibility" />
   </div>
   
<div id="midHeader" style="z-index: -1000">
 
<div id="hideMe4" style="
	z-index: -1000;
	display: '';
"><script type="text/javascript">
AC_FL_RunContent( 'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','775','height','197','title','Header','src','/Core_images/elements/Test resize','quality','high','pluginspage', 'https://www.macromedia.com/go/getflashplayer','movie','/Core_images/elements/Test resize' );
 //end AC code
</script><noscript><object type="application/x-shockwave-flash"
data="c.swf?path=/Core_images/elements/Test resize.swf" 
width="775" height="197">
<param name="movie" 
value="c.swf?path=/Core_images/elements/Test resize.swf" />
</object></noscript></div> 
 
	
</div>
      <div id="search">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td>
      <div class="login_OUT"><a href="my-account/login/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Account&nbsp;&frasl;&nbsp;</a><a href="https://www.sjrmc.org/Core/my-account/login" title="My Account">login</a>&nbsp;|</div>
       </td>
    
    <td>
<form id="cntnt01moduleform_1" method="get" action="index.php"><div class="hidden"><input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" /><input type="hidden" name="cntnt01returnid" value="125" /></div>
 
    <label for="cntnt01searchinput">Search</label>:&nbsp;<input type="text" name="cntnt01searchinput" size="20" maxlength="50" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;"/><input name="submit" value="Submit" type="submit" onMouseDown="javascript:toggleDiv('hideMe3')"/>
 
</form>
 
</td>
     </tr>
  
</table>
   </div>
   
      <div class="breadcrumbs">
        You are here: <a href="https://www.sjrmc.org/Core/DoctorDirectory">Find a Doctor</a> » <span class="lastitem">Anesthesiology</span>
   <hr class="accessibility" />
   </div>
   
      <div id="content">
            <div id="sidebar">
            <div id="menu_vert">
 
 
<ul class="menulist" id="listMenuRoot">
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/" accesskey="1" ><dfn>1: </dfn>St. Joseph Home</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/services" ><dfn>2: </dfn>Services</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/auxiliary-volunteer" ><dfn>2.1: </dfn>Auxiliary Volunteer</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/regional-cancer-center" ><dfn>2.2: </dfn>Regional Cancer Center</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/services/CHERC" ><dfn>2.3: </dfn>Resource Center</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/cpr" ><dfn>2.3.1: </dfn>CPR</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/first-aid" ><dfn>2.3.2: </dfn>First Aid</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/family-beginnings-classes" ><dfn>2.3.3: </dfn>Family Beginnings Classes</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/diabetes-center-education" ><dfn>2.3.4: </dfn>Diabetes Center-Education</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/tobacco-free-you" ><dfn>2.3.5: </dfn>Tobacco Free You</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/nutrition-education" ><dfn>2.3.6: </dfn>Nutrition Education</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/services/CHERC/wound-and-ostomy-education" ><dfn>2.3.7: </dfn>Wound and Ostomy Education</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/staff-content/health-news"  target="_self"><dfn>2.5: </dfn>Health News</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/family-beginnings" ><dfn>3: </dfn>Family Beginnings</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/family-beginnings/classes-groups" ><dfn>3.1: </dfn>Classes and Groups</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/family-beginnings/newborns" ><dfn>3.2: </dfn>Newborns</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/family-beginnings/newborns/2007-2" ><dfn>3.2.1: </dfn>2007</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/family-beginnings/newborns/2008-2" ><dfn>3.2.2: </dfn>2008</a>
 
 
	</li></ul></li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/events-calendar" ><dfn>4: </dfn>Events Calendar</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/events-calendar/today-at-st-joe-s" ><dfn>4.1: </dfn>Today at St. Joe&#39;s</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/about-st-joseph" ><dfn>5: </dfn>About St. Joseph</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/about-st-joseph/contact-st-joseph" ><dfn>5.1: </dfn>Contact St. Joseph</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/about-st-joseph/accreditations" ><dfn>5.2: </dfn>Accreditations</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/about-st-joseph/publications" ><dfn>5.3: </dfn>Publications</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/about-st-joseph/news" ><dfn>5.4: </dfn>News</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/about-st-joseph/awards" ><dfn>5.5: </dfn>Awards</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/foundation" ><dfn>6: </dfn>Foundation</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/foundation/board-members" ><dfn>6.1: </dfn>Board Members</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/foundation/foundation-projects" ><dfn>6.2: </dfn>CENTURY CLUB</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/foundation/foundation-projects-2" ><dfn>6.3: </dfn>Foundation Projects</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/gift-shop" ><dfn>7: </dfn>Gift Shop</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/employment-opportunities" ><dfn>8: </dfn>Employment Opportunities</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/DoctorDirectory" ><dfn>10: </dfn>Find a Doctor</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology" ><dfn>10.1: </dfn>Anesthesiology</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/LarryDavis" ><dfn>10.1.1: </dfn>Larry Davis, M.D.</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" ><dfn>10.1.2: </dfn>Thomas J. Grissom, M.D.</a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')"
href="https://www.sjrmc.org/Core/DoctorDirectory/cardiology" ><dfn>10.2: </dfn>Cardiology</a>
 
 
	<ul>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/cardiology/lee-gould-m-d" ><dfn>10.2.1: </dfn>Lee Gould, M.D. </a>
 
 
	</li></ul>
	</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/dentistry" ><dfn>10.3: </dfn>Dentistry</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/dermatology" ><dfn>10.4: </dfn>Dermatology</a>
 
</li>
	<li><a onmousedown="javascript:toggleDiv('hideMe3')" 
href="https://www.sjrmc.org/Core/DoctorDirectory/emergency-medicine" ><dfn>10.5: </dfn>Emergency Medicine</a>
 
 
	</li></ul>		</li>
	</ul>
 
 
<script type="text/javascript">
//<![CDATA[
 
 
var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
 
 
listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;
listMenu.animations[listMenu.animations.length] = FSMenu.animClipDown;
 
 
var arrow = null;
if (document.createElement && document.documentElement)
{
 arrow = document.createElement('span');
 arrow.appendChild(document.createTextNode('>'));
 // Feel free to replace the above two lines with these for a small arrow image...
 //arrow = document.createElement('img');
 //arrow.src = 'arrow.gif';
 //arrow.style.borderWidth = '0';
 arrow.className = 'subind';
}
addEvent(window, 'load', new Function('listMenu.activateMenu("listMenuRoot", arrow)'));
 
 
// You may wish to leave your menu as a visible list initially, then apply its style
// dynamically on activation for better accessibility. Screenreaders and older browsers will
// then see all your menu data, but there will be a 'flicker' of the raw list before the
// page has completely loaded. If you want to do this, remove the CLASS="..." attribute from
// the above outermost UL tag, and uncomment this line:
//addEvent(window, 'load', new Function('getRef("listMenuRoot").className="menulist"'));
 
//]]>
</script>
 
 
         <h2 class="accessibility">Navigation</h2>
      </div>
                  <div id="news">
         <h2><a href="https://www.sjrmc.org/Core/about-st-joseph/news" onMouseDown="javascript:toggleDiv('hideMe3')">News</a></h2>
          <!-- Displaying News Module -->
<!-- News Categories: '' -->
<!-- Start News Display Template -->
 
 
<div class="NewsSummary"> <div class="NewsSummaryPostdate">05/30/2008</div>
    <div class="NewsSummaryLink"><a href="https://www.sjrmc.org/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">Brenda McIntosh 2008 Employee of the Year</a></div>
  <div class="NewsSummaryCategory">Category: Employee News</div>
     <!--<div class="NewsSummaryAuthor">Posted by: StjoeAdmin</div>-->
    <div class="NewsSummarySummary">Brenda McIntosh, a 24-year employee of St. Joseph Regional Medical Center, has been selected as the 2008 Employee of the Year in recognition of her many contributions.</div>
  <div class="NewsSummaryMorelink" onMouseDown="javascript:toggleDiv('hideMe3')"><span style="float:left; line-height:13px;">[<a href="https://www.sjrmc.org/Core/news/3/88/Brenda-McIntosh-2008-Employee-of-the-Year">More</a>]</span><span style="float:right; line-height:13px;"><a href="https://www.sjrmc.org/Core/about-st-joseph/news">&#91;Browse&#93;</a></span><br/></div>
  </div>
<!-- End News Display Template -->
      </div>
<div style="text-align:left;" >
 
 
<a href="../pacs.html" onclick="return popup(this,'bigwindow')" ><img border="0" width="204" src="../pacs.png" height="38" alt="PACS Link"/></a>
</div>
<div style="text-align:right;" >
<br/><a href="https://www.sjrmc.org/Core/staff-content/health-news"><img src="/St_Joe_Core/images/icon-healthday-box.gif" alt="Health Day" width="200" height="157" border="0" style="margin-left:10px;"></a><br/><br/>
<a target="_self" href="/Core/services/CHERC/"><img border="0" width="180" src="/St_Joe_Core/images/cherc_DB_flat.png" alt="Community Health Education Resource Center" height="63" /></a>
<br/>
<br/>
<a target="_self" href="https://www.sjrmc.org/Core/foundation" onmousedown="javascript:toggleDiv('hideMe3')"><img border="0" width="180" src="/St_Joe_Core/images/logo_foundation.gif" alt="St. Joseph Regional Medical Center Foundation" height="50" /></a>
<br/>
<a target="_blank" href="http://www.ascensionhealth.org/"><img border="0" width="160" src="../images/logo_ascension_health.gif" alt="Ascension Health" height="73" /></a>
<br/><br/>
</div>
            </div>
                  <div id="main">
         <div style="float: right;"><a href="help" target="_self" onmousedown="javascript:toggleDiv('hideMe3')"><img src="images/cms/help.gif" alt="Help" width="28" height="28" border="0"/></a><a href='https://www.sjrmc.org/Core/index.php?mact=Printing,m5,printpage,1&amp;m5showbutton=1&amp;m5script=1&amp;m5returnid=125&amp;page=125' class='noprint'  >  <img src='modules/Printing/printbutton.png' alt='Print this page' />
</a>
</div>
         <h2>Anesthesiology</h2>
         
<div class="category_items">
<ul id="CHERClist" style="line-height:13px; font-size:16px; vertical-align:top; float:left;">
    <li><a href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/LarryDavis" onmouseover="switch1('LarryDavis_f_1_400_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Larry Davis, M.D.</a></li>
    <li><a href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/thomas-j-grissom-m-d" onmouseover="switch1('anesthesiology_ct_1_90_1');" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Thomas J. Grissom, M.D.</a></li>
  </ul>
<div id="image-switch" class="image-switch">
<div style="line-height:13px; font-size:16px; vertical-align:top;">
<div id="Blank"></div>
   <div id="LarryDavis_f_1_400_1"><img src="uploads/images/catalog/LarryDavis_f_1_400_1.jpg" title="Larry Davis, M.D." alt="Larry Davis, M.D."/></div>
    <div id="anesthesiology_ct_1_90_1"><img src="uploads/images/catalog/anesthesiology_ct_1_90_1.jpg" title="Thomas J. Grissom, M.D." alt="Thomas J. Grissom, M.D."/></div>
   </div></div></div><div style="clear:right;"></div>  
 <br />
 	 <div class="hr"><table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Qiuck Contact List">
  <tr>
    <td align="right"><span style="color:#00194d;font-weight: bold;"><a href="about-st-joseph/contact-st-joseph/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Contact Us</a> &bull; <a href="find-a-doctor/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Find A Doctor</a> &bull; <a href="services/CHERC/" target="_self" onMouseDown="javascript:toggleDiv('hideMe3')">Join A Class</a></span></td>
  </tr>
</table></div>
 
         <div>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="9px"><img src="images/Aceess_Link_left.gif" width="9" height="51" alt=" "/></td>
    <td class="AccessLink"><span class="AccessLinktitle" >Accessibility  links</span><br/><span class="AccessLinks" >Previous page: <a href="https://www.sjrmc.org/Core/DoctorDirectory" title="Find a Doctor">Find a Doctor</a><br/> 
Next page: <a href="https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology/LarryDavis" title="LarryDavis">Larry Davis, M.D.</a></span>
</td>
    <td width="41px"><img src="images/Aceess_Link_right.gif" width="41" height="51" alt=" "/></td>
  </tr>
</table>
 
         </div>
         	 
      <hr class="accessibility" />
      </div>
	     </div>
         <div id="footer">
      <br/>This site was Created by <a href="http://digitalbarn.tv/"><font color="#ffffff"><font color="#ff0000">d</font>igital <font color="#ff0000">b</font>arn productions</font></a><br/>
Managed by <script type="text/javascript"><!-- 
document.write("<a ", "href=\"", "&#109;a&#105;&#108;", "t&#111;", ":","dbjeremy", "&#64;","cableone.net","?subject=","From St joe", "\"><font style=\"","color:#ffffff","\">","Jeremy Bass","</", "font>", "</", "a>");
//--></script><br/><br/>
   </div>
<div id="hideMe3" style="
display: none;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
">
 
<script type="text/javascript"> 
AC_FL_RunContent( 'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','362','height','35','title','Header','src','/Core/elements/pageLoading','wmode', 'transparent','quality','high','pluginspage', 'https://www.macromedia.com/go/getflashplayer','movie','/Core/elements/pageLoading' ); 
//end AC code
</script><noscript><object type="application/x-shockwave-flash"
data="c.swf?path=/Core/elements/pageLoading.swf" 
width="362" height="35">
<param name="wmode" value="transparent" />
<param name="movie" 
value="c.swf?path=/Core/elements/pageLoading.swf" />
</object></noscript></div> 
   </div>
</td>
    <td id="rightGRD">
</td>
  </tr>
</table>
</body>
</html>
<!-- 2.315178 / 127 -->

Open in new window

ok... so i have been working it and got it to show back up... but i get an error saying that divs is undefined?  man this is meesing with me lol...


Current:
{literal}
<script type='text/javascript'>
window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
      var debug = document.getElementById( 'debug' );
      if ( debug ) {
        var msg = '';
        for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
          if ( id && id != 'debug' ) {
            msg += id + '<br>';
          }
        }
        if ( msg != '' ) {
          debug.innerHTML = 'DIV ID list:<br>' + msg;
        }
      }
    }
  }
</script>
 
 
<script language="JavaScript"  type="text/javascript">
<!--
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divs.length; i++) 
{ obj=document.getElementById(divs[i]);
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
document.write("<style type=\"text/css\">");
document.write("<!--");
for(var i=0; i<divs.length; i++) {
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
document.write("{display:none;}");
document.write("-->");
document.write("</style>");
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
 
{/literal}

Open in new window

ok i think i nailed were the issues are....

function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divs.length; i++)
{ obj=document.getElementById(divs[i]);         <<<<<<<<<this?
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}


orginal
function switch1(div) {
if (document.getElementById('Anesthesiology')) {
var option=['Anesthesiology','Cardiology','Dentistry','Dermatology','EmergencyMedicine'];
for(var i=0; i<option.length; i++)
{ obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none"; }
}
}


and

document.write("<style type=\"text/css\">");
document.write("<!--");
for(var i=0; i<divs.length; i++) {
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
document.write("{display:none;}");
document.write("-->");
document.write("</style>");




current....
<script language="JavaScript"  type="text/javascript">
<!--
window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
      var debug = document.getElementById( 'debug' );
      if ( debug ) {
        var msg = '';
        for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
          if ( id && id != 'debug' ) {
            msg += id + '<br>';
          }
        }
        if ( msg != '' ) {
          debug.innerHTML = 'DIV ID list:<br>' + msg;
        }
      }
    }
 
 
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divs.length; i++) 
{ obj=document.getElementById(divs[i]);
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
document.write("<style type=\"text/css\">");
document.write("<!--");
for(var i=0; i<divs.length; i++) {
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
document.write("{display:none;}");
document.write("-->");
document.write("</style>");
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>

Open in new window

oh, and your question at this point is what?
um... ? well why is doesn't work i guess is the question...  I'm still working on it... but no luck... lol
What doesn't work?
What does work?
The question, as stated doesn't tell me what it does correctly,
or what messages are generated, or what happens...

I need more to go on...

sorry about that... I get object expected error on both onmouseover events... and the images  are not being set to display:none.... I've tired writing it but no luck... lol....

https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology
function ids that starts in line 98 doesn't have a good ending closing curly brace...
Dang... well now i get 'divs' is undefined... sure as heck thought there were lol
I have been round and round.... and i keep getting 'divs' undefined.... I have no idea why this is....
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
}
      var debug = document.getElementById( 'debug' );
      if ( debug ) {
        var msg = '';
        for ( var i = 0; i < divs.length; i++ ) {
          var id = divs[ i ].getAttribute( 'id' );
          if ( id && id != 'debug' ) {
            msg += id + '<br>';
          }
        }
        if ( msg != '' ) {
          debug.innerHTML = 'DIV ID list:<br>' + msg;
        }
      }
    }
}
 
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divs.length; i++) 
{ obj=document.getElementById(divs[i]);
obj.style.display=(divs[i]==div)? "block" : "none"; }
}
}
//
function switchImg(i){
document.images["blank"].src = i;
}
 
document.write("<style type=\"text/css\">");
 
for(var i=0; i<divs.length; i++) {
document.write("#", divs[i], ",");
}
document.write("#", "Blank");
document.write("{display:none;}");
 
document.write("</style>");
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}

Open in new window

Do you know from where that message might be coming?

- Probably line 32, since divs is not a global variable,
  nor is it local to switch1()
- and line 44, since it (divs) is not global

Do you get the "# divs" alert?

This loop doesn't really do anything (lines 10-12)
----------------------------------------------------------------------
      for ( var i = 0; i < divs.length; i++ ) {
        var id = divs[ i ].getAttribute( 'id' );
      }
----------------------------------------------------------------------

Even if you declare divs as a global variable, how is the code
at the end supposed to work?  i.e., this?

----------------------------------------------------------------------
  document.write("<style type=\"text/css\">");
 
  for( var i=0; i < divs.length; i++ ) {
    document.write("#", divs[i], ",");
  }
  document.write("#", "Blank");
  document.write("{display:none;}");
 
  document.write("</style>");
----------------------------------------------------------------------

  At the point this code would be executed, the page has
yet to be rendered, so no 'image-switch' divs would yet
exist...
Sorry, there, Yeah I'm still getting the 4 divs alert... the error is on 117 and 129, both 'divs' undefined...


for this,
----------------------------------------------------------------------
  document.write("<style type=\"text/css\">");
 
  for( var i=0; i < divs.length; i++ ) {
    document.write("#", divs[i], ",");
  }
  document.write("#", "Blank");
  document.write("{display:none;}");
 
  document.write("</style>");
----------------------------------------------------------------------
The thought was I wanted to used write out a style, should i put that in s function and trigger it after the divs have loaded?...

I'll check on it after morning meetings but if you think the errors are from something else ... Im open for ideas... Thanks for the help...
Let me check/test something.  I have an idea that might help
Not a prob, I got bogged down again today and can't get on this until Tomorrow anyways... same for the other post... but Ill post the same line in there as well... thank you again for the help... I'm learning a lot going through this...

jeremyBass
The thing that I want to test, and have yet to get to is accessing & manipulating
the document.styleSheets collection.  This is not something that I have done yet,
so I'm learning as I go.
Hello, so i don't know if you having any luck, I sure am not lol... here is where i'm at...

the thought was to, use the CSS as a function,
as
var headID = document.getElementsByTagName("head")[0];
var cssNode = switchImgCSS;
headID.appendChild(cssNode);

just not sure were to go, google doesn't show anything helpful yet...


Current
////////////////////in the head
///////////////////////////////////
 
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
 
       }
var headID = document.getElementsByTagName("head")[0];
var cssNode = switchImgCSS;
headID.appendChild(cssNode);
}
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++) 
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}
 
function switchImgCSS(){
document.write("<style type=\"text/css\">");
document.write("<!--");
for(var i=0; i<divsids.length; i++) {
document.write("#", divsids[i], ",");
}
document.write("#", "Blank");
document.write("{display:none;}");
document.write("-->");
document.write("</style>");
}
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}
 
 
 
 
 
///////////////////////after the div 'image-switch'
/////////////////////////////////////////////////////
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
ids();
//-->
</script>
{/literal}

Open in new window

Oh i think i'm on to some thing here.... righ now this cause the CSS to go wacko for the whole thing... but may-be you'll see a way to make this work?



here is the idea

function css(CSSid, display) {
      if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
      else if (CSSid=="END") return '</STYLE>'
      var str = '#'+CSSid+' {display:'+display+';''
      str += '}\n'
      return str
}
function writeCSS(str,showAlert) {
      str = css('START')+str+css('END')
      document.write(str)
      if (showAlert) alert(str)
}

var str = css('START')+
css('divset','none')+
css('END')
document.write(str)
/////////All in head...
//////////////////////////////////
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
 
       }
}
function css(CSSid, display) {
	if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
	else if (CSSid=="END") return '</STYLE>'
	var str = '#'+CSSid+' {display:'+display+';''
	str += '}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++) 
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}
 
for(var i=0; i<divsids.length; i++) 
{ 
var divset = divsids(i);
}
 
 
var str = css('START')+
css('divset','none')+
css('END')
document.write(str)
 
 
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}

Open in new window

I keep movon on.... I got the css to not break but i keep getting the same damn error... 'divsids' undefined.... i just don't get it lol... i thought that i was calling it well after the div is writen by the DOM.... ??? lol


FYI... I will be out after 4pm PST and will be gone for my son's surgery for the next four days... so I will not be able to do much if any thing...


thanks again...
jeremyBass
////////////////////in the head
///////////////////////////////////
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
//window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
 
       }
}
function css(CSSid, display) {
	if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
	else if (CSSid=="END") return '</STYLE>'
	var str = '#'+CSSid+' {display:'+display+';}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END');
	document.write(str);
	if (showAlert) alert(str);
}
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++) 
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}
 
for(var i=0; i<divsids.length; i++) 
{ 
var divset = divsids(i);
}
 
var str = css('START')+
css('divset','none')+
css('END');
document.write(str);
writeCSS(str,showAlert);
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}
 
 
///////////////////////after the div 'image-switch'
/////////////////////////////////////////////////////
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
window.onload=ids;
//-->
</script>
{/literal}

Open in new window

Well I'm so confused on this... Still getting 'divsids' undefined on line 115... I get the alert...


just kind spinning my wheels on this... I'm open for work arounds and or any other way to do the same thing... thanks for the help.. :)
You are having "fun" with trying to change the style sheet portion of the
document because of the information described here:

http://www.quirksmode.org/dom/changess.html

Very yucky.  

What do you want to do?
Well... that was informative read... I kind think I get what your driving at by having me read that... but I'm not sure how or why this would cause 'divsids' undefined...


So What do I want to do... well I have to make this work... so... I guess down the road I go...


So if I understand all of that.... I'd have to do something like this?
function changeIt() {
      if (!document.styleSheets) return;
      var theRules = new Array();
      if (document.styleSheets[1].cssRules)
            theRules = document.styleSheets[1].cssRules
      else if (document.styleSheets[1].rules)
            theRules = document.styleSheets[1].rules
      else return;
      theRules[theRules.length+1].style.display = 'none';
}

but how to place it in & ???? lol



This did seem to work but the divsids thing keep getting in the way....
function css(CSSid, display) {
      if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
      else if (CSSid=="END") return '</STYLE>'
      var str = '#'+CSSid+' {display:'+display+';}\n'
      return str
}
function writeCSS(str,showAlert) {
      str = css('START')+str+css('END');
      document.write(str);
      if (showAlert) alert(str);
}
var str = css('START')+
css('divset','none')+
css('END');
document.write(str);
writeCSS(str,showAlert);


This is where I got the idea.....
example
http://www.jalix.org/ressources/internet/dhtml/_dynduo/dynduo/examples/generate2-cssfunction.html

article
http://www.jalix.org/ressources/internet/dhtml/_dynduo/dynduo/en/generate.html


I thought I could get it to work... What you think... I just need it to work in the end, but I'm willing to try anything as long as it is crossB and IE6+... or a solution for each...   Thanks for the help on this...
Well one thing that I got from it is how difficult it is to have a cross browser function that can be used to manipulate a STYLE section.

The undefined divsids is a totally different issue...

I hadn't looked for that.  Sorry.

If you attach your whole thing, I can help figure it out.

Remember, to "attach" a JavaScript file, copy it to a file with a different extension.
e.g.,

copy  filename.js  filename.js.txt

and attach the filename.js.txt with a comment that identifies the correct filename & extension
Hello, well this is it all... It is a cms site so It's hard to pull all acting items together but it think this is all of it... let me know if you think there is something else i should post...

this is the loaction of the page being worked on...
https://www.sjrmc.org/Core/DoctorDirectory/Anesthesiology

"Well one thing that I got from it is how difficult it is to have a cross browser function that can be used to manipulate a STYLE section."

Yeah... I can't wait for the day were the major browsers are more in line with each other on handling code... ~wishing~ lol

Let me know... thank you again for the help....


note: this is a smarty based cms in case it makes a diff...

//////////////In the head
 
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
//window.onload=ids;
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
 
       }
}
function css(CSSid, display) {
	if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
	else if (CSSid=="END") return '</STYLE>'
	var str = '#'+CSSid+' {display:'+display+';}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END');
	document.write(str);
	if (showAlert) alert(str);
}
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++) 
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}
 
for(var i=0; i<divsids.length; i++) 
{ 
var divset = divsids(i);
}
 
var str = css('START')+
css('divset','none')+
css('END');
document.write(str);
writeCSS(str,showAlert);
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}
 
 
 
 
////////////in the body
<script language="JavaScript"  type="text/javascript">
<!--
ids();
//-->
</script>

Open in new window

Full-page.txt
the-dynamicTEMPLAT.txt
The best thing to do is to understand the point in the code that is causing
the error.  Do you, by any chance, know what line of code is causing the
error?

Your earlier post:

https://www.experts-exchange.com/questions/23481743/Get-Div-id.html?anchorAnswerId=21849299#a21849299

says, line 115.  But the associated code doesn't have 115 lines.  So I can't tell
which one is causing the error.

Hello, sorry for the delay... I got a brand new dual quad machine... I needed to get it up and running... but back to the task :P

On a brand new "just got to the page" I get the divsids undefined on 125
obj.style.display=(divsids[i]==div)? "block" : "none"; }

But if I refresh I get an all clear till I rollover the links... then I get divsids undefined on 115
function writeCSS(str,showAlert) {

I'm not sure... but this seems wrong on the errors 125 seems likely, but not the 115... not sure....
Tell you what, send me the new toy (i.e., the new dual qual core computer), and we'll call it even.  You can request a refund for the points for this question, and I won't dispute it.  :-)

As far as the "divsids undefined on 125"...

Please provide the code for the containing function, and how it is invoked/called.

Apparently, this line is being executed without the definition/assignment for the divsids having been executed.  This would account for the error message.

It is also possible that the code is being executed before the entire page is loaded, which could result in the assignment being null (i.e., document element not found because the load had not yet completed).  This kind of "timing related" issue is sometimes called a "race condition".  Where one part of the code is expecting a value to be available before it actually is.

lol, my whole family pitched in for it, it was my first fathers day present :) I think they went over board cause of my sons surgery... lord knows I needed a new one lol but you never know, may every fathers day will be that great lol...

well that functon is...
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++)
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
  which doesn't make sense since it is not suppose to run until the rollover, but then on the rollover it says it's erroring in a place that make again no sense on why....
function writeCSS(str,showAlert) {
get written not on the rollover
ok, let's take a look at that code:

Where in this function does divsids get assigned?

It doesn't!  So, when line # 3 (here), gets executed, it is referencing a "global"
variable named divsids.  If that variable doesn't exist when that statement is
executed, you will get the "undefined" error mentioned above.

p.s., I have yet to get any such nice Father's Day presents.  :-(  And my oldest
is 23.
1|function switch1( div ) {
2|  if ( document.getElementById( 'blank' ) ) {
3|    for ( var i=0; i < divsids.length; i++ ) {
4|      obj = document.getElementById( divsids[ i ] );
5|      obj.style.display = ( divsids[ i ] == div ) ? "block" : "none";
6|    }
7|  }
8|}

Open in new window

That is what is confusing me...


This defines the divsid.....
  function ids() {
    var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
 
       }
}



but I put this below the div in the body
<script language="JavaScript"  type="text/javascript">
<!--
ids();
//-->
</script>

So the divs would be there before the function ran... on the static version I use

window.onload=ids;

At the beginning and everything works fine...

static version...
https://www.sjrmc.org/Core/DoctorDirectory


so... well loopdie-lue I'm confused on the why ... I thought i was grading aginst premature running of the functions...

p.s.- well that settles it... I must have got it cause it's my first fathers day and my son's surgery... lol... well Im not going to complain...
So, are you still getting the "undefined"?

Which option are you using?
yes I'm still getting the undefined... I'm using the:
<script language="JavaScript"  type="text/javascript">
<!--
ids();
//-->
</script>

but have tryed both...
ok, so where is this script?  in the <body> portion of your document?

ooh, I have an idea... What if we change it that to something like this?

What this does is to check to see if the variable (divsids) exists, if not,
it will wait for 1/10 of a second, and try again.  This retry logic will be
attempted 10 times (i.e., for a max of 1 second).

How does that sound?


  var retries = 10;  // Maximum number of retry attempts
 
  function ids() {
    if ( typeof( divsids ) == 'undefined' ) {
      if ( retries > 0 ) {
        retries--;
        setTimeout( 'ids()', 100 );   // Wait .1 seconds ...
      } else {
        alert( 'Error: divsids is undefined.' );
      }
    } else {
// ==> Put current ids() code here <==
    }
  }

Open in new window

I'm so lost on why this is not going...


So I liked you idea and thought it's work.... but since the function ids() defines the I switched it around... to what is below and using the window.onload=ids;


So I get ... alert( '# divs: ' + divs.length );.... then alert( 'Pass: divsids are defined.' );

The thought was that if the function didn't work that it throw the alert( 'Error: divsids is undefined.' );.... but it did not... but I still get the divsids undefined when you rollover the links.... so....

Could it be that the divsids are not leaving the function?


window.onload=ids;
 
  var retries = 10;  // Maximum number of retry attempts
  function ids() {
var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          var divsids = divs[ i ].getAttribute( 'id' );
          }
       }
    if ( typeof( divsids ) == 'undefined' ) {
      if ( retries > 0 ) {
        retries--;
        setTimeout( 'ids()', 100 );   // Wait .1 seconds ...
      } else {
        alert( 'Error: divsids is undefined.' );
      }
    } else {
 alert( 'Pass: divsids are defined.' );
    }
  }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I love progess... so I made the change... and error 'Object required' on line 129... but i get both
alert( '# divs: ' + divs.length );
alert( 'Pass: divsids are defined.' );
so that seems good.....

function writeCSS(str,showAlert) {
      str = css('START')+str+css('END');
129>      document.write(str);
      if (showAlert) alert(str);
}

??? the object is there!???
here is the lastest full code... (all in the head)
{literal}
<script language="JavaScript"  type="text/javascript">
<!--
window.onload=ids;
var divsids;
  var retries = 10;  // Maximum number of retry attempts
  function ids() {
var image_switch = document.getElementById( 'image-switch' );
    if ( image_switch ) {
      var divs = image_switch.getElementsByTagName( 'DIV' );
      alert( '# divs: ' + divs.length );
          for ( var i = 0; i < divs.length; i++ ) {
          divsids = divs[ i ].getAttribute( 'id' );
          }
       }
    if ( typeof( divsids ) == 'undefined' ) {
      if ( retries > 0 ) {
        retries--;
        setTimeout( 'ids()', 100 );   // Wait .1 seconds ...
      } else {
        alert( 'Error: divsids is undefined.' );
      }
    } else {
 alert( 'Pass: divsids are defined.' );
    }
  }
 
function css(CSSid, display) {
	if (CSSid=="START") return '<STYLE TYPE="text/css">\n'
	else if (CSSid=="END") return '</STYLE>'
	var str = '#'+CSSid+' {display:'+display+';}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END');
	document.write(str);
	if (showAlert) alert(str);
}
 
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++) 
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}
 
for(var i=0; i<divsids.length; i++) 
{ 
var divset = divsids(i);
}
 
var str = css('START')+
css('divset','none')+
css('END');
document.write(str);
writeCSS(str,showAlert);
//-->
</script>
<style type="text/css">
<!--
#image-switch div{float:right;}
#image-switch ul {
margin:0 0 0 20px; 
color:red; 
list-style-type:none;
}
#image-switch li {
padding:10px;
}
-->
</style>
{/literal}

Open in new window

The problem is that in the header, you can't use:

document.write()

as you try to do with with this code.
The "document.write()" routine can only be used in the body portion of the document.

However, we "might" be able to use information (like that shown above)
https://www.experts-exchange.com/questions/23481743/Get-Div-id.html?anchorAnswerId=21854368#a21854368
to "modify" the document styleSheet object.
  var str = css( 'START' ) + css( 'divset', 'none' ) + css( 'END' );
  document.write( str );
  writeCSS( str, showAlert );

Open in new window

I see ... I think i got it now... I'll have to take a break for a bit... but hopefully I'll be back with it finished...

this is the route---
http://www.jalix.org/ressources/internet/dhtml/_dynduo/dynduo/examples/generate2-cssfunction.html


I think~  :-)
ok I give up on my way... how would you think your way would be?... i tryed a coulpe wacks at it but got now worth posting...    thanks again for the help here
Let's see if I understand the current form of the question...

How can the style sheet for the current document be modified?

Would that be accurate?

If so, please define the kinds of modifications needed.  At this point,
however, it is important to realize that it is much (much) easier to
have all of the different styles predefined and simply to change the
class attribute of document elements than it would be to manipulate
the document style sheet.

Does that make sense?
How can the style sheet for the current document be modified?
//////////YES
in the sense that #id's have to be formed after the divs in the dom are formed... the divs change quickly and so I can't hard code the #id's for the css

If so, please define the kinds of modifications needed.
////////////
The whole point is to have the divs be set to display none right off the bat.... then only on a mouse over event on the ui will the corresponding image, base on the ids, be set to in accordance to
function switch1(div) {
if (document.getElementById('blank')) {
for(var i=0; i<divsids.length; i++)
{ obj=document.getElementById(divsids[i]);
obj.style.display=(divsids[i]==div)? "block" : "none"; }
}
}
 
function switchImg(i){
document.images["blank"].src = i;
}


please define the kinds of modifications needed.  At this point,
however, it is important to realize that it is much (much) easier to
have all of the different styles predefined
////////////////////////
I wish I could, but the #ids change so the code need to work around that...

Thanks again for the help here...
This is the anwser for this question... thourght it highlighted a new one... I'll repost the second part of the questtion...
Well, I'm glad that this one, at least,

Thanks for the grade & points.

Good luck.
the funny thing is that i posted about the css part and this is what the result....


// Add a mouseover="updateDivs(this)" to all your image_switch divs
 
function updateDivs(divId) {
  var image_switch = document.getElementById( 'image-switch' );
  var divs = image_switch.getElementsByTagName( 'DIV' );
  for ( var i = 0; i < divs.length; i++ ) {
    if (divs[i].style.display == 'block') {
      divs[i].style.display = 'none';
    }
  }
  document.getElementById(divId).style.display = 'block';
}

which mean we did a alot of learning lol... still... I must thank you.... you help alot and got me thinking more... thank you
You are very welcome.  That why I like this place... :-)