Jump to content


Check out our Community Blogs

bluefenix

Member Since 13 Aug 2012
Offline Last Active Nov 13 2012 11:07 AM
-----

Topics I've Started

When button clicked twice do something

06 November 2012 - 02:54 PM

I need that when a button is clicked once it will show the message "Hide. And when clicked twice returns to the original message "Show". The first thing I already did it, I only need help with the second thing, that being the second click.

function show()
	{
		document.myform.button.value ="Hide";//Changes message on button when clicked.
		document.myform.button.innerHTML= "Hide";
	}
	
	<form>
	<input type=button value= "Show" name="button" id= "idButton"
	onclick="show()">
	</form>

A simple program

17 September 2012 - 03:59 PM

Im having troubble with this program, I need two functions the window.onload one will hide all the divs when the page loads. The variables declarations are fine, since I tested in the original one to hide some divs and show other when select box selected. For example when selected men(option) will show "Divs Men" and when women(option) is selected it will show "Divs Women". It works fine, Im just having troubble when I add the onloadFunction, I think maybe Im mistaking in calling the variables of function shoesOne to function default(the onload one). Or maybe Im declaring wrongly the onload function Any help is appreciated.

function shoesOne()
{

//**

//Divs Men
var colorWD= document.getElementById("selectDiv1");
var paraWD= document.getElementById("selectDiv2");

//Divs Women
var marcaMD= document.getElementById("selectDiv02");
var puntaD= document.getElementById("selectDiv03");
var cierreD= document.getElementById("selectDiv04");
var suelasD= document.getElementById("selectDiv05");
}


window.onload= function default()
{ //Men
colorWD.style.display= "none";
paraWD.style.display= "none";

//Women
marcaMD.style.display= "none";
puntaD.style.display= "none";
cierreD.style.display= "none";
suelasD.style.display= "none";
}

[SOLVED] A simple program [alert("Something")]

16 September 2012 - 02:16 PM

I have a problem with a simple program, I hope you can help me with it. What I want is that when the select option "Male" it shows a message and when "Female" its selected it shows another one.


<div id="selectContainer">
<form method= 'POST' id="myform">
<div class= "selectDiv">
<label>**</label>
<select id= "**" onchange="zapatosOne()">
<option value="1">Male</option>
<option value="2">Female</option>
</select>
</div>

var selectSex= document.getElementById("**").selectedIndex;
var sexS= document.getElementById("**").options[selectSex].text;
var sexB= document.getElementById("**").options[selectSex].value;

if (sexB =="1")
{
alert("One two three four");
}

else if (sexB =="2")
{
alert("Five");
}

else
(
alert("No div selected.");
)

TRIGGER(SET)

17 August 2012 - 04:12 PM

Hello everyone. I hope you are all well. I have been struggling with a DB program. I hope you can help me with it. Here are four tables MORNING, AFTERNOON, MIDNIGHT, and SUMMARY the first three are exactly the same and the fourth one sums all of the fields in the first three tables except for idDay which is the PRIMARY TABLE of the four tables. My attempt was to create a trigger(SUMMIT_M) that fires when the MORNING table is changed and sets it to its currently value, then another trigger(SUMMIT_F) that fires when the AFTERNOON table is filled and sums the current SUMMARY tables value to the AFTERNOON one and stores it into the SUMMARY table.

CREATE TABLE MORNING(
idDay MEDIUMINT NOT NULL AUTO_INCREMENT,
noProgEx SMALLINT,
noPRead SMALLINT,
noPReadArt SMALLINT,
noArtEx SMALLINT,
PRIMARY KEY (idDay),
FOREIGN KEY(idDay)REFERENCES MORNING(idDay));

CREATE TABLE SUMMARY(
idDay MEDIUMINT NOT NULL AUTO_INCREMENT,
noProgExSum SMALLINT,
noPReadSum SMALLINT,
noPReadArtSum SMALLINT,
noArtExSum SMALLINT,
PRIMARY KEY (idDay),
FOREIGN KEY(idDay)REFERENCES MORNING(idDay)
);
CREATE TRIGGER SUMIT_M AFTER INSERT ON MORNING
FOR EACH ROW
BEGIN
INSERT INTO SUMMARY
VALUES (MORNING.idDay, MORNING.noProgEx, MORNING.noPRead, MORNING.noPReadArt, MORNING.noArtEx);
END;

INSERT INTO SUMMARY
(SET SUMMARY.noProgExSum =MORNING.noProgEx, SET SUMMARY.noPReadSum= MORNING.noPRead,
SET SUMMARYnoArtExSum= MORNING.noPReadArt);
END;

CREATE TRIGGER SUMIT_A AFTER INSERT ON AFTERNOON
FOR EACH ROW BEGIN
INSERT INTO SUMMARY
(SET SUMMARY.noProgExSum =SUMMARY.noProgExSum + AFTERNOON.noProgEx, SET SUMMARY.noPReadSum= SUMMARY.noPReadSum + AFTERNOON.noPRead,
SET SUMMARYnoArtExSum= SUMMARYnoArtExSum + AFTERNOON.noPReadArt);

END;

Help with code[checkbox.checked && div id(hide || show)]

13 August 2012 - 01:06 PM

Hello everybody, Im working on a project and I want that when clicked on the "national" checkbox the country div shows and the europe div hides and when clicked on the international happens the other way around. In my effort of achieving this, Ive wrote this code, though it doesnt work. Can anybody tell me what did I do wrong or how should I pursue this?

<body>
<div><div><form id= "form1">
<input type="checkbox" name="option3" value="national" id= 'national' onchange= "f()"> National</input>
<input type="checkbox" name="option4" value="internacional" id= 'inter' onchange= "f()"> International</input>
<input type="button" value="check" onclick="f()">
</form>
</div>
<script type= "text/javascript">

var nation= document.getElementById("national");
var international= document.getElementById("inter");

var country= document.getElementById("country");
var europe= document.getElementById("europe");

function f()
{
if (nation.checked= true) &&(international.checked= false)
{ country.style.display='block';
europe.style.display='none'; }
else if (nation.checked= true) &&(international.checked= false)
{ country.style.display='none';
europe.style.display='block'; }
else if (international.checked= true) &&(nation.checked= true)
{ country.style.display='none';
europe.style.display='none';
alert("Dont select both at the same time.")}

else
{ peru.style.display='none';
europe.style.display='none'; }}
</script>

<!--This div only appears if national its selected
-->
<div id= 'country'>
<form id= 'regiones'method= 'POST'>
<select id= 'selection'>Uno
<option>Uno</option>
<option>Due</option>
</select>
</form>
</div>

<!-- This div only appears if international its selected
-->
<div id= "europe">
<form id= 'Europea'method= 'POST'>One
<select id= 'sel1'>
<option>One</option>
<option>Two</option>
</select>
</form>
</div> </div>
</body>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download