1
Answer

.NET toggle hidden/visible

innersoul

innersoul

20y
2.2k
1
Hi, I was just wondering if anyone knew if the code below can be easily implemented in ms studio (.NET)? If so...how? All it does is it has a sort of link so when you click on site it shows the hidden stuff. If you click it again, it dissapears. (all on the same page). I'm not the one who wrote the code but I wanted to write something similar to it but before I could do so, I wanted to know if anyone knew if it can be easily implemented into .NET and if so..any suggestions on where to start and all would be greatly appreciated... Thank you. *****HTML Code****

Site

Company Name: Petro Canada
City:                     Ottawa
***JSS file *** var popupWin; function openWindow(url, example){ if (typeof(popupWin) != "object" || null == popupWin) popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0"); else { if (!popupWin.closed) popupWin.location.href = url; else popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0"); } popupWin.focus();} function ExpandDiv(theDivName) { InitializeGlobalData(); if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return; theDiv.style.display = "block"; var thePic = allImages[theDivName + "_img"]; if (null != thePic && typeof(thePic) != "undefined") { thePic.src = "/global/images/bluedrop.gif"; thePic.alt = strHide; } } function CollapseDiv(theDivName) { InitializeGlobalData(); if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return; theDiv.style.display = "none"; var thePic = allImages[theDivName + "_img"]; if (null != thePic && typeof(thePic) != "undefined") { thePic.src = "/global/images/blueup" + strIsRtl + ".gif"; thePic.alt = strShow; } } function ToggleDiv(theDivName) { InitializeGlobalData(); if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivs[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return; if (theDiv.style.display.toUpperCase() != "BLOCK") ExpandDiv(theDivName); else CollapseDiv(theDivName); } function AlterAllDivs(displayStyle) { InitializeGlobalData(); if (null == allDivs || typeof(allDivs) == "undefined") return; if (typeof(allDivs["divShowAll"]) != "undefined" && typeof(allDivs["divHideAll"]) != "undefined") { if (displayStyle == "block") { allDivs["divShowAll"].style.display = "none"; allDivs["divHideAll"].style.display = "block"; } else { allDivs["divShowAll"].style.display = "block"; allDivs["divHideAll"].style.display = "none"; } } AlterAllDivsSpans(document.body.getElementsByTagName("DIV"), displayStyle); AlterAllDivsSpans(document.body.getElementsByTagName("SPAN"), displayStyle); } function AlterAllDivsSpans(allDivsSpans, displayStyle) { if (typeof(allDivsSpans) == "undefined" || null == allDivsSpans) return; for (i=0; i < allDivsSpans.length; i++) if (typeof(allDivsSpans[i]) != "undefined" && null != allDivsSpans[i] && typeof(allDivsSpans[i].id) != "undefined" && null != allDivsSpans[i].id && allDivsSpans[i].id.length > 0) { if (0 == allDivsSpans[i].id.indexOf("divExpCollAsst_")) { var thePic = allImages[allDivsSpans[i].id + "_img"]; if (displayStyle == "block") { allDivsSpans[i].style.display = "block"; if (typeof(thePic) != "undefined" && null != thePic) { thePic.src = "/global/images/bluedrop.gif"; thePic.alt = strHide; } } else { allDivsSpans[i].style.display = "none"; if (typeof(thePic) != "undefined" && null != thePic) { thePic.src = "/global/images/blueup" + strIsRtl + ".gif"; thePic.alt = strShow; } } } if (0 == allDivsSpans[i].id.indexOf("divInlineDef_")) if (displayStyle == "block") allDivsSpans[i].style.display = "inline"; else allDivsSpans[i].style.display = "none"; } } function ToggleAllDivs() { InitializeGlobalData(); if (fExpanded) AlterAllDivs("none"); else AlterAllDivs("block"); fExpanded = !fExpanded; } function ToggleAll() { InitializeGlobalData(); ToggleAllDivs(); } function InitializeGlobalData() { if ('undefined' != typeof(strRtl)) strIsRtl = strRtl; var divs = document.body.getElementsByTagName("DIV"); var spans = document.body.getElementsByTagName("SPAN"); var countDiv = 0; var countSpan = 0; if (typeof(divs) != "undefined" && null != divs) countDiv = divs.length; if (typeof(spans) != "undefined" && null != spans) countSpan = spans.length; allDivs = new Array(); for (i=0; i < countDiv; i++) if (typeof(divs[i].id) != "undefined" && null != divs[i].id && divs[i].id.length > 0) allDivs[divs[i].id] = divs[i]; for (i=0; i < countSpan; i++) if (typeof(spans[i].id) != "undefined" && null != spans[i].id && spans[i].id.length > 0) allDivs[spans[i].id] = spans[i]; allImages = document.body.getElementsByTagName("IMG"); } function OnSeeAlsoClicked() { InitializeGlobalData(); if (null == allDivs || typeof(allDivs) == "undefined") return; if (typeof(allDivs["divSeeAlsoShowBullet"]) != "undefined" && typeof(allDivs["divSeeAlsoHideBullet"]) != "undefined") { if (allDivs["divSeeAlsoShowBullet"].style.display.toUpperCase() == "INLINE") { allDivs["divSeeAlso"].style.display = "block"; allDivs["divSeeAlsoShowBullet"].style.display = "none"; allDivs["divSeeAlsoHideBullet"].style.display = "inline"; } else { allDivs["divSeeAlso"].style.display = "none"; allDivs["divSeeAlsoShowBullet"].style.display = "inline"; allDivs["divSeeAlsoHideBullet"].style.display = "none"; } } } var strIsRtl = ''; var allDivs = null; var allImages = null; var fExpanded = false;
Answers (1)