473,396 Members | 2,154 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,396 software developers and data experts.

Page load and checkbox value

Hi,

I have a form on and ASP page that has a checkbox (chkAnyTheme) which
disables a list box (txtListThemes) with an onclick event. I also have
the follwoing code that checks if the chkAnyTheme is checked when the
page loads and if so disableds txtListThemes:

<script type="text/javascript">
var IsChecked = document.getElementById("chkAnyTheme")
if (IsChecked.checked)
{
document.getElementById("txtListThemes").disabled = true
alert("Checked is True")
}
</script>

this works fine when the page is loaded from the server but i also
need it to work if the user uses the back/forward button. At the
moment the moment the script is not picking up if chkAnyTheme is
checked and doesn't disable txtListThemes. Then if the user clicks on
chkAnyTheme the on click code that disables txtListThemes gets
confused and disables txtListThemes when chkAnyTheme is not checked
and vice versa.

I think that maybe when the page loads using the back/forward buttons
the code is exectued before checkbox is assigned a value. Does anyone
know a way of getting round this?
Jul 23 '05 #1
2 2506
Lee
Lukelrc said:
this works fine when the page is loaded from the server but i also
need it to work if the user uses the back/forward button. At the
moment the moment the script is not picking up if chkAnyTheme is
checked and doesn't disable txtListThemes. Then if the user clicks on
chkAnyTheme the on click code that disables txtListThemes gets
confused and disables txtListThemes when chkAnyTheme is not checked
and vice versa.

I think that maybe when the page loads using the back/forward buttons
the code is exectued before checkbox is assigned a value. Does anyone
know a way of getting round this?


Execute that code in the onLoad handler of the body.
Then it won't look for the checkbox until after it has been set.

Also, the code in the checkbox's onclick handler should check
the current value, so it can never get confused.

Jul 23 '05 #2
Thanks, now it works fine!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

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

Similar topics

5
by: rathnesh | last post by:
when using a web application which includes taking an asp page then going to another asp page and coming back to first page ...some times connection to iis gets terminated and page canot be...
1
by: Lisa | last post by:
I have a search page that displays all data from a table <%For intIndex = 1 To rstPalm.RecordCount%> <tr> <td><font size="2" face="arial"><%=rstPalm("load_id")%></font></td> <td><font size="2"...
1
by: LastOfEight | last post by:
I'm trying to hide tables in the code below, but it is not working. Could someone take a look at my code? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">...
3
by: Chris Thunell | last post by:
I have an aspx web form with a table that i'm sending via response.write... in one of the cells i would like to put a dynamically created server control. The amount of rows is variable... so i...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
3
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not...
1
by: yoknows | last post by:
Hello .Net Gurus. This is my first post here so I apologize in advance if I have not provided the right information. I hope someone has seen this problem before and can tell me what I am doing...
3
by: scotp | last post by:
Does anyone know what would cause excessive page faults running the js function below? The most common browser used is IE 6. The page has records that include text & checkbox inputs. Each...
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: 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?
0
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,...
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
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...
0
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,...
0
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...

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.