473,487 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DIV display state changes

I have been developing an image gallery which needed to be dynamic as
possible.

so I have placed the gallery in a div plus a div containing the large
image to be displayed. It works by changing the display property of the
gallery div to 'none' and the largeImage div to 'block' which has an
affect of switching pages but obviously saving time developing a single
page for each large Image, but (cliche') when I refresh the page with
the large Image div displaying 'block' it reverts the gallery and
largeImage display's back to their default states.

how can i prevent these states from reverting back to their default
states?

Here is the code example:
script language="javascript" type="text/javascript">
<!--
function displayImage(imgSrc){
document.getElementById('theGallery').style.displa y = 'none';
document.getElementById('imageContainer').style.di splay = 'block';
var image = document.getElementById('largeImage');
image.src = imgSrc;
}

function displayGallery(){
document.getElementById('theGallery').style.displa y = 'block';
document.getElementById('imageContainer').style.di splay = 'none';
}
//-->
</script>

</head>

<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">

<div id="imageContainer" style="display:none; position:relative;
top:10px; text-align:center;">
<img id="largeImage"><br>
<a href="enable.html" onClick="displayGallery(); return false;">Go
back</a>
</div>
<div id="theGallery" style="display:block;">
<a href="enable.html" onClick="displayImage('imgs/large/large1.jpg');
return false;">
<img src="imgs/thumbs/thumb1.jpg" width="90" height="120" border="0">
</a></div>

Feb 3 '06 #1
3 2249
DoomedLung wrote:
I have been developing an image gallery which needed to be dynamic as
possible.

so I have placed the gallery in a div plus a div containing the large
image to be displayed. It works by changing the display property of the
gallery div to 'none' and the largeImage div to 'block' which has an
affect of switching pages but obviously saving time developing a single
page for each large Image, but (cliche') when I refresh the page with
the large Image div displaying 'block' it reverts the gallery and
largeImage display's back to their default states.

how can i prevent these states from reverting back to their default
states?


You can't.

HTML is stateless - when you refresh the page, you reload the page's
initial state. All varaibles, etc. previously defined in javascript are
gone.

Feb 3 '06 #2
That's right. You'd have to use some sort of server side technology to
remember the state of things.

JJ

Feb 3 '06 #3
Lee wrote:
DJ Majestik said:

That's right. You'd have to use some sort of server side technology to
remember the state of things.


Or a cookie.


Doh - I hate it when I miss the obvious :P

Feb 6 '06 #4

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

Similar topics

19
6850
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
4
1516
by: RL Stevenson | last post by:
Often I want to change the Enable or Visibility on a control when some other control on the form changes. Or maybe I need to make a change to the DataSource on a combo box when the user makes a...
0
5795
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
3
1158
by: Marc Robitaille | last post by:
Hello, I have a Web page with several ASPX Textbox. I added to my page a property which enables me to know the state of this one. The values of this property are: Consultation Modified New...
5
548
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
4
2336
by: DoomedLung | last post by:
I have been developing an image gallery which needed to be dynamic as possible. so I have placed the gallery in a div plus a div containing the large image to be displayed. It works by changing...
1
4509
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I...
70
4257
by: Anson.Stuggart | last post by:
I'm designing a debounce filter using Finite State Machine. The FSM behavior is it follows the inital input bit and thinks that's real output until it receives 3 consecutive same bits and it...
4
2384
by: laktofil | last post by:
This may seem like an abstract question on behavioral inheritance. Anyway, I'm building a hierarchical state machine in C++ (with gcc for target platform Gentoo Linux). More precisely, I'm using this...
0
7137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
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...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7349
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...
0
5442
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,...
1
4874
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...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
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 ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.