Register and join over 40,000 other developers!
Recent Topics
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
-
Job Gig PHP Form Needed
PJohnson - Apr 18 2019 03:55 AM
-
How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
-
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

A simple program [alert("Something") && checkbox.checked]
Started by bluefenix, Aug 13 2012 08:52 AM
simple easy simple program alert checkbox
3 replies to this topic
#1
Posted 13 August 2012 - 08:52 AM
Hello everybody. Ive wrote a simple program, more simple than what I usually do, but somehow
it doesnt work. I just want it that when you check the checkbox and click the button an alert
message appears. If a message appears only when the checkbox is checked that works too.
Thanks for reading this, and hopefully youll answer to this post.
Ciao
<div id= "div">
<form id= "row" method= "POST">Dulce/Salado
<input type="checkbox" name="option3" value="International" id= 'inter'> International</input>
<input type="button" value="check" onclick="f()">
</form>
</div>
<script type= "text/javascript">
function f()
{
var inter= document.form.getElementById("inter");
if (inter.checked== true)
{
alert("Something");
}
}
</script>
it doesnt work. I just want it that when you check the checkbox and click the button an alert
message appears. If a message appears only when the checkbox is checked that works too.
Thanks for reading this, and hopefully youll answer to this post.
Ciao
<div id= "div">
<form id= "row" method= "POST">Dulce/Salado
<input type="checkbox" name="option3" value="International" id= 'inter'> International</input>
<input type="button" value="check" onclick="f()">
</form>
</div>
<script type= "text/javascript">
function f()
{
var inter= document.form.getElementById("inter");
if (inter.checked== true)
{
alert("Something");
}
}
</script>
#2
Posted 13 August 2012 - 09:00 AM
Here:
<form id= "row" method= "POST">Dulce/Salado <input type="checkbox" name="option3" value="International" id= 'inter'> International</input> <input type="button" value="check" onclick="f()"> </form> <script type= "text/javascript"> function f() { var inter= document.getElementById("inter"); if (inter.checked== true) { alert("Something"); } } </script>
#4
Posted 13 August 2012 - 12:23 PM
Now it works, thanks a lot. But how will this be without the button, just the checkbox. When the checkbox is checked display an alert:
<div id= "div">
<form id= "row" method= "POST">Dulce/Salado
<input type="checkbox" name="option3" value="International" id= 'inter'> International</input>
</form>
</div>
<script type= "text/javascript">
function f()
{
var inter= document.getElementById("inter");
if (inter.checked== true)
{
alert("Something");
}
}
</script>
<div id= "div">
<form id= "row" method= "POST">Dulce/Salado
<input type="checkbox" name="option3" value="International" id= 'inter'> International</input>
</form>
</div>
<script type= "text/javascript">
function f()
{
var inter= document.getElementById("inter");
if (inter.checked== true)
{
alert("Something");
}
}
</script>
Also tagged with one or more of these keywords: simple, easy, simple program, alert, checkbox
![]() Call to script via ajax $.post fails unless followed by alert()Started by sayitblue, 11 Jul 2015 ![]() |
|
![]() |
||
![]() Save checkboxes to SQLite DatabaseStarted by DarkHeart, 26 Mar 2015 ![]() |
|
![]() |
||
Language Forums →
Java →
Simple game in Java Tic-Tac-ToeStarted by Sudharshan, 29 Aug 2014 ![]() |
|
![]() |
||
Language Forums →
C# →
C# adding "focus" to a checkbox windows formsStarted by rubbadrools, 02 Apr 2014 ![]() |
|
![]() |
||
Language Forums →
Java →
Trouble with Transposing a 2D ArrayStarted by Andex, 16 Feb 2014 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download