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

Home Posts Topics Members FAQ

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

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 the
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" alt="Playboy UK Babes" title="Playboy UK
Babes"><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
4 2329
DoomedLung said the following on 2/3/2006 7:08 AM:
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 the
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?


Set a cookie with "state" in it. When the page is loaded, read the
cookie and set the corresponding state in the page.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '06 #2

Randy Webb wrote:
DoomedLung said the following on 2/3/2006 7:08 AM:
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 the
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?


Set a cookie with "state" in it. When the page is loaded, read the
cookie and set the corresponding state in the page.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Hey Randy, cheers for the speedy response but I forgot to mention that
I've tried that method already and it didn't work!?

Feb 3 '06 #3
DoomedLung said the following on 2/3/2006 7:26 AM:
Hey Randy, cheers for the speedy response but I forgot to mention that
I've tried that method already and it didn't work!?


Then you did it wrong. And know that cookies are not always accepted.
Reading/writing a cookie is the only way you are going to be able to
track state of a dynamic page from the client side.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '06 #4

Randy Webb wrote:
DoomedLung said the following on 2/3/2006 7:26 AM:
Hey Randy, cheers for the speedy response but I forgot to mention that
I've tried that method already and it didn't work!?


Then you did it wrong. And know that cookies are not always accepted.
Reading/writing a cookie is the only way you are going to be able to
track state of a dynamic page from the client side.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


ok, thanks.

Feb 3 '06 #5

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

Similar topics

19
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
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
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
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
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...
3
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.