473,805 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Small (?) script change needed.

Hi,

For a hobby site, I found this script and I'd like it to work the other way
around. The content has to show and the visitor has to click to hide it.
Could someone help me please? I'm a total Java-newbie...

TIA
Jaap

Here's the code:

in <head>tag
<script type="text/javascript">
<!--
var storedDiv = null;
function getDiv(oID) {
if(document.get ElementById) {
return document.getEle mentById(oID);
} else if( document.all ) {
return document.all[oID];
} else { return null; }
}
window.onload = function () {
for( var i = 0, y; y = getDiv('ans'+i) ; i++ ) {
y.style.display = 'none';
}
};
function toggleInfo(oID) {
var oDiv = getDiv(oID); if( !oDiv ) { return; }
oDiv.style.disp lay = (oDiv.style.dis play=='none') ? 'block' : 'none';
if( storedDiv && storedDiv != oDiv ) { storedDiv.style .display = 'none';
} storedDiv = oDiv;
}
//--></script>
in <body>tag
<span style="cursor:h and; cursor:pointer" onclick="toggle Info('ans0');">
Hide/show content

</span><br><br>
<div id="ans0">

content

</div>

Jul 23 '05 #1
1 1201
solution: using a different script...

<script type="text/javascript">
/* This goes in the head section */
window.onload = function() {
document.getEle mentById('hidea ble').style.dis play = 'block'; }

function toggle(link, divid) {
var div = document.getEle mentById(divid) ;
if (div.style.disp lay == 'none') {
div.style.displ ay = 'block';
link.innerHTML = 'Hide Sponsors';
} else {
div.style.displ ay = 'none';
link.innerHTML = 'Show Sponsors';
}
}
</script>

<a href="#hideable " onclick="toggle (this, 'hideable'); return false;">Hide Sponsors</a><br><br>
<div id="hideable">

content

</div>

"Jaap" <ja********@vel dhorst.nl> schreef in bericht
news:PC******** **********@amsn ews05.chello.co m...
Hi,

For a hobby site, I found this script and I'd like it to work the other way around. The content has to show and the visitor has to click to hide it.
Could someone help me please? I'm a total Java-newbie...

TIA
Jaap

Here's the code:

in <head>tag
<script type="text/javascript">
<!--
var storedDiv = null;
function getDiv(oID) {
if(document.get ElementById) {
return document.getEle mentById(oID);
} else if( document.all ) {
return document.all[oID];
} else { return null; }
}
window.onload = function () {
for( var i = 0, y; y = getDiv('ans'+i) ; i++ ) {
y.style.display = 'none';
}
};
function toggleInfo(oID) {
var oDiv = getDiv(oID); if( !oDiv ) { return; }
oDiv.style.disp lay = (oDiv.style.dis play=='none') ? 'block' : 'none';
if( storedDiv && storedDiv != oDiv ) { storedDiv.style .display = 'none';
} storedDiv = oDiv;
}
//--></script>
in <body>tag
<span style="cursor:h and; cursor:pointer" onclick="toggle Info('ans0');"> >> Hide/show content

</span><br><br>
<div id="ans0">

content

</div>

Jul 23 '05 #2

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

Similar topics

5
2628
by: Tim Morrison | last post by:
Is there any easy way to create a change script as illustrated below for all tables within a database? Right now I would have to create a seperate script for each table. I would like to be able to update the customers database while preserving their exisiting data. -------------------------------------------------------------------------------- BEGIN TRANSACTION
0
3232
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. Background: For typical script debugging issues, you can read and follow the two documents on...
7
2185
by: Tim Rogers | last post by:
Hi folks, this is a resolution-detect script that I used on a site. As you can see it is designed to detect when the screen resolution falls below a certain level then load an alternative style sheet HOWEVER, is it possible to make a change to the code that will not only make it respond to windows with widths of less than 800 pixels but ALSO heights of less than 600 pixels. I'm a complete novice when it comes to .js so and help would...
8
4319
by: RomanRusso | last post by:
Hie everybody, Here at this forum I have found something what I was looking for - rotation of cells in html table, here is the link http://www.thescripts.com/forum/threadnav149304-2-10.html The gue named RobD posted a nice script there. You can easily modify it for the needs of your table, but one problem occured on my way, maybe somebody can help. For instance if there is <a> tags inside one table cell, the script willl rotate only the...
9
2103
by: smartbei | last post by:
Hello, I am a newbie with python, though I am having a lot of fun using it. Here is one of the excersizes I am trying to complete: the program is supposed to find the coin combination so that with 10 coins you can reach a certain amoung, taken as a parameter. Here is the current program: coins = (100,10,5,1,0.5) anslist = def bar(fin, hist = {100:0,10:0,5:0,1:0,0.5:0}): s = sum(x*hist for x in hist)
3
3689
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of html is: <a class="searchsavechanges btn btn3d tbbtn" href="javascript:" style="position:static"> <div id="TBsearchsavechanges">Search</div> </a>
2
2780
by: Jorgen Bodde | last post by:
Hi all, This is slightly OT but it drives me nuts. Whenever I create a shortcut in the start menu (in Windows) of a python script, it will only execute it when the path where the script resides in contains no spaces. For example; d:\src\app\app.py If I drag that to the Start Menu it can be executed fine.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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

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