473,569 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

toggle .value property ?

Good morning,

on form 2 input elements and 1 image are placed. The 1st (Index[0]) one is
"hidden", the 2nd [Index[1]) is an empty textbox.
When clicking the picture I would like to toogle a boolean value. (displayed
in the textbox).
The following function reacts correctly on the first click. Any further
click as no effect (is returns "TRUE" in the textbox).
Where is the mistake ? How can I solve the problem ?
Thank you very much in advance.
Best regards
Juergen Heyn, Wilhelmshaven, Germany

<script language="JavaS cript">
<!--

function toggle()
{
if(document.for ms[0].elements[0].value="yes")
{
document.forms[0].elements[1].value="TRUE";
document.forms[0].elements[0].value="no";
}
else
{
document.forms[0].elements[1].value="FALSE";
document.forms[0].elements[0].value="yes";
}
}

// -->
</script>

<body>

<form action="">
<p>
<input type="hidden" name="YesNo" value="yes">
<input type="text" name="Textbox" size="20">
<a href="#" onClick=toggle( )>
<img src="Button.gif " border="0" width="36" height="36">
</p>
</form>

</body>
Jul 20 '05 #1
3 2368
Ivo
"Jürgen Heyn" <j.****@gmx.d e> wrote in message
news:c0******** *****@ID-94872.news.uni-berlin.de...
(...)

function toggle()
{
if(document.for ms[0].elements[0].value="yes")
{
document.forms[0].elements[1].value="TRUE";
document.forms[0].elements[0].value="no";
}
else
{


I suppose you mean
if(document.for ms[0].elements[0].value=="yes")
with double "="
Also note that "TRUE" between quotes is not a boolean, but a string.
HTH
Ivo
Jul 20 '05 #2
Hi Ivo,

Thank you very much for the hint. This was actually my mistake.
Coming from Visual Basic the double "==" was unknown.
Thanks again !
Regards
Jürgen
"Ivo" <no@thank.you > schrieb im Newsbeitrag
news:40******** *************** @news.euronet.n l...
"Jürgen Heyn" <j.****@gmx.d e> wrote in message
news:c0******** *****@ID-94872.news.uni-berlin.de...
(...)

function toggle()
{
if(document.for ms[0].elements[0].value="yes")
{
document.forms[0].elements[1].value="TRUE";
document.forms[0].elements[0].value="no";
}
else
{


I suppose you mean
if(document.for ms[0].elements[0].value=="yes")
with double "="
Also note that "TRUE" between quotes is not a boolean, but a string.
HTH
Ivo

Jul 20 '05 #3
On Fri, 13 Feb 2004 17:43:59 +0100, Ivo <no@thank.you > wrote:
Also note that "TRUE" between quotes is not a boolean, but a string.


Considering that the value property of form controls is of type string, do
you really think it matters much?

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #4

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

Similar topics

2
2278
by: leegold2 | last post by:
I wondered if anyone would give me code- I think it would be easy, but I'm a complete newbie. What I want to do is to show many tables in a brief truncated format and then for each table offer the user the ability to toggle so they can see the full content of each table individually. The code I got from the net below works fine for *one*...
11
4799
by: MLH | last post by:
Why is that? If I choose the tiny check boxes which are hard to hit with a mouse, it works fine. But option buttions, shich can be sized big enough for people with limited sight and dexterity to hit - they don't work at all. Its true. I created 'em with the built-in wizard furnished with Access 97 but they do not work. I put 12 of 'em...
2
3345
by: John | last post by:
Hi How can I create a toggle button on a toolbar that would enable/disable editing on the current form? Thanks Regards
4
4338
by: Neil Coleclough | last post by:
I am constructing a database to process product returns for my Company. I have a number of toggle buttons to identify the stage to which each return has been processed. For example, clicking the first button confirms that the goods are now in our building awaiting initial processing. This button then fires off an email to our warehouse staff...
2
7954
by: Mel | last post by:
Hi, is there any way I can implement toolstrip toggle button simular to the MS Word alignment button? if one toggle button already pressed down, if user click on the "pushed down button", the other toggle button will push down and the "pushed down button" will push up. I have trying to find groupID for toolstrip button, but seem like they...
4
8953
by: deko | last post by:
Basic question about checking the value of Toggle/Check/Combo/OptionGroups.... Checking like this: If Me!chkCheckBox Then ... End If and like this:
3
3814
by: Killer42 | last post by:
Hi all. I have a frame with some toggle buttons in it. All is working fine, except that the user can't tell which option is selected to begin with. How do I set one of the toggle buttons to the down position at design time? (All controls are unbound). I have done some searching on TheScripts, and found a couple of cases where it was...
1
4426
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I can't get this button does work properly. The documentation I found in the FM20.CHM files says the button state can be determined from its "Value"...
2
5253
by: Chuck | last post by:
How can I make an array of command buttons (or toggle buttons) on a form and have a text box on the same form display the index of the button clicked? This works very well in VB6, but I can't duplicate the action in Access. Chuck
0
7700
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...
0
8125
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...
0
6284
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...
1
5513
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
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
0
938
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...

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.