Why doesn't this code work when trigger = 0; ?

wxdqz

New Member
Why doesn't this code work when trigger = 0; ?
When the button "Marqee" is pressed, then a marque should start to run, but when trigger = 0; instead of trigger = 1; , then when you press the Marquee button...nothing happens.
Anyone knows why or what i did wrong?
Just look at the mb() funtion, the tOne() function and the part of the code that says>> trigger = 1; (should actually be trigger = 0; , but that doesn't work)
You can copy/paste the code and try it out yourself to see what happens.

_____
The purpose of the Marquee button is that the marquee starts scrolling when the button is pressed.
I have no idea when trigger is set to 0, why the marquee doesn't start scrolling when the button is pressed.
This is actually what i'm trying to resolve here, the marquee should start scrolling on the moment when the button(marquee) is pressed.
_____
Thanks.



<html>
<head>


<title>WeekOpdracht voor Week 4</title>
<script language="javascript">
<!--


function kop()
{
document.write('<H1><b>LottoGenerator</b></H1>');
}

function rng() // Random Number Generator functie
{


if (nr1==0)
{

nr1 = parseInt(Math.random() * dGetal);
while (nr1==0)
{
nr1 = nr1 + 1;
}
}



while ((nr2==nr1)||(nr2==nr3)||(nr2==nr4)||(nr2==nr5)||(nr2==nr6)||(nr2==nr7)||(nr2==0))
{
nr2 = parseInt(Math.random() * dGetal);
}


while ((nr3==nr1)||(nr3==nr2)||(nr3==nr4)||(nr3==nr5)||(nr3==nr6)||(nr3==nr7)||(nr1==0))
{

nr3 = parseInt(Math.random() * dGetal);

}


while ((nr4==nr1)||(nr4==nr2)||(nr4==nr3)||(nr4==nr5)||(nr4==nr6)||(nr4==nr7)||(nr4==0))
{

nr4 = parseInt(Math.random() * dGetal);

}


while ((nr5==nr1)||(nr5==nr2)||(nr5==nr3)||(nr5==nr4)||(nr5==nr6)||(nr5==nr7)||(nr5==0))
{

nr5 = parseInt(Math.random() * dGetal);

}


while ((nr6==nr1)||(nr6==nr2)||(nr6==nr3)||(nr6==nr4)||(nr6==nr5)||(nr6==nr7)||(nr6==0))
{

nr6 = parseInt(Math.random() * dGetal);

}


while ((nr7==nr1)||(nr7==nr2)||(nr7==nr3)||(nr7==nr4)||(nr7==nr5)||(nr7==nr6)||(nr7==0))
{

nr7 = parseInt(Math.random() * dGetal);

}



document.write('<b>1)</b> <font color="red"><b>'+nr1+'</b></font><br>');
document.write('<b>2)</b> <font color="red"><b>'+nr2+'</b></font><br>');
document.write('<b>3)</b> <font color="red"><b>'+nr3+'</b></font><br>');
document.write('<b>4)</b> <font color="red"><b>'+nr4+'</b></font><br>');
document.write('<b>5)</b> <font color="red"><b>'+nr5+'</b></font><br>');
document.write('<b>6)</b> <font color="red"><b>'+nr6+'</b></font><br>');
document.write('<b>7)</b> <font color="red"><b>'+nr7+'</b></font><br>');

}


function tOne() //trigger is one function
{
trigger = parseInt(1);
return trigger;
}

function mb() // marquee button on finction
{
document.write('<form><input type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Marquee" onClick="tOne();"></form>');
}

function rb() //refresh button of vernieuwknop
{
document.write('<form><input type=button value=http://www.webdeveloper.com/forum/archive/index.php/"Vernieuw" onClick="document.location.reload();"></form>');
}


//-->
</script>
</head>

<!-- Begin body //-->
<body>
<script language="javascript"> // Script met koptekst
<!--
kop();

document.write("<table cellspacing=0 cellpadding=0 border=3>"); <!-- Tabel marquee button //-->
document.write("<tr>");
document.write("<td>");


mb(); //button function


document.write("</td>");
document.write("</tr>");
document.write("</table>");

document.write("<table width=250 height=30 cellspacing=0 cellpadding=0 border=5>"); <!-- Tabel met marquee //-->
document.write("<tr>");
document.write("<td>");

var trigger = 1; //You see this is the part i mean, when you change this to trigger = 0; , then the code doesn't work, but it's supposed to, no errors.

if (trigger==1)
{
document.write('<marquee><b>Win 1 miljoen Euro!</b></marquee>');

{

document.write("</td>");
document.write("</tr>");
document.write("</table>");

<!-- Begin tabel //-->
document.write("<table width=250 height=200 cellspacing=0 cellpadding=30 border=5>"); <!-- Tabel met nummers //-->
document.write("<tr>");
document.write("<td>");

var dGetal = parseFloat(49); // Deelgetal
var nr1 = parseInt(Math.random() * dGetal);
var nr2 = parseInt(Math.random() * dGetal);
var nr3 = parseInt(Math.random() * dGetal);
var nr4 = parseInt(Math.random() * dGetal);
var nr5 = parseInt(Math.random() * dGetal);
var nr6 = parseInt(Math.random() * dGetal);
var nr7 = parseInt(Math.random() * dGetal);

rng();

document.write("</td>");
document.write("</tr>");
document.write("</table>");

// Script met Refresh Button

rb();






} }//-->
</script>
</body>
</html>
 
Back
Top