Click here to Skip to main content
15,923,852 members
Home / Discussions / Web Development
   

Web Development

 
GeneralCLR access policies Pin
fridtjof10-Nov-04 8:06
fridtjof10-Nov-04 8:06 
QuestionIf you are to design a shopping cart page that has a submit button, how do you prevent the user from clicking the submit button twice for the same transaction without using JavaScript? Pin
nicksun10-Nov-04 5:30
nicksun10-Nov-04 5:30 
AnswerRe: If you are to design a shopping cart page that has a submit button, how do you prevent the user from clicking the submit button twice for the same transaction without using JavaScript? Pin
Jack Puppy12-Nov-04 1:00
Jack Puppy12-Nov-04 1:00 
AnswerRe: If you are to design a shopping cart page that has a submit button, how do you prevent the user from clicking the submit button twice for the same transaction without using JavaScript? Pin
rgoyal13-Nov-04 0:53
rgoyal13-Nov-04 0:53 
Generalasp button Pin
cmarmr10-Nov-04 4:18
cmarmr10-Nov-04 4:18 
GeneralRe: asp button Pin
velkropie15-Nov-04 16:10
velkropie15-Nov-04 16:10 
GeneralMicrosoft Multimedia Control 6.0 Pin
andyleonhart9-Nov-04 21:18
andyleonhart9-Nov-04 21:18 
Generaljavascript problem Pin
samithas9-Nov-04 20:04
samithas9-Nov-04 20:04 
I want to create a javascript tha achoieves the fullowing functions
1. when page loads it shows images from random locations
2. Whenever the user click the mouse anywhere on the browser the images should be hidden
3. After some time duration diaplay the images again

here is my code
<html>
<body>
<script language="JavaScript1.2">
<!--



Cupid=new Image();
loaded =true;
Cupid.src="bat.gif"; //specify path to bat image
amount=3; //Number of cupids, minimum must be 3.
Xpos=700; //cupids x coordinates, in pixel
Ypos=200; //cupids y coordinates, in pixel
step=0.3; //Animation speed (smaller is slower)
dismissafter=15; //seconds after which Cupids should disappear, in seconds

yBase=xBase=currStep=a_count=0;
flycupid=0;
b_count=1;
c_count=2;
d_count=3;
move=1;
var ns6=document.getElementById&&!document.all
bats=new Array(3)




if (document.layers){
//alert('start in if1');
for (i=0; i < amount; i++)
{
document.write("<LAYER NAME=n"+i+" LEFT=0 TOP=-50><a href='http://www.dynamicdrive.com'><IMG SRC='"+Cupid.src+"' NAME='nsi' width=69 height=60 border=0></a></LAYER>")}
}
else if (document.all||ns6)
{

document.write('<div id="out" style="position:absolute;topBlush | :O ;leftBlush | :O "><div id="in" style="position:relative">');
for (i=0; i < amount; i++)
{
if (document.all)
{
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="msieBats" style="position:absolute;top:-50;leftBlush | :O " border=0></a>')
//alert('start in if2');
}
else
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="ns6Bats'+i+'" width=69 height=60 style="position:absolute;top:-50;leftBlush | :O " border=0></a>')
}
document.write('</div></div>');
}


if (document.layers||ns6)
{
//alert('start in if3');
yBase=window.innerHeight/3;
xBase=window.innerWidth/6;
if (document.layers)
window.captureEvents(Event.MOUSEMOVE);
}
if (document.all)
{

yBase = window.document.body.offsetHeight/3;
xBase = window.document.body.offsetWidth/6;
}



if (document.layers)
{

for (i=0; i < amount; i++)
document.layers['n'+i].document.images['nsi'].src=Cupid.src
}
else if (document.all)
{

for (i=0; i < amount; i++)
{
document.all.msieBats[i].src=Cupid.src
//alert('start in if6');
}
}
else if (ns6)
{
for (i=0; i < amount; i++)
document.getElementById("ns6Bats"+i).src=Cupid.src
}



function dismisscupid()
{

clearInterval(flycupid)
if (document.layers)
{
for (i2=0; i2 < amount; i2++)
{
document.layers['n'+i2].visibility="hide"
}
}
else if (document.all)
document.all.out.style.visibility="hidden"
else if (ns6)
document.getElementById("out").style.visibility="hidden"


}
function cleanUP()
{

Cupid=new Image();

Cupid.src="bat.gif"; //specify path to bat image
amount=3; //Number of cupids, minimum must be 3.
Xpos=700; //cupids x coordinates, in pixel
Ypos=200; //cupids y coordinates, in pixel
step=0.3; //Animation speed (smaller is slower)
dismissafter=15; //seconds after which Cupids should disappear, in seconds

yBase=xBase=currStep=a_count=0;
flycupid=0;
b_count=1;
c_count=2;
d_count=3;
move=1;
var ns6=document.getElementById&&!document.all
bats=new Array(3)


if (document.layers){

for (i=0; i < amount; i++)
{
document.write("<LAYER NAME=m"+i+" LEFT=0 TOP=-50><a href='http://www.dynamicdrive.com'><IMG SRC='"+Cupid.src+"' NAME='nsi' width=69 height=60 border=0></a></LAYER>")}
}
else if (document.all||ns6)
{

document.write('<div id="out" style="position:absolute;topBlush | :O ;leftBlush | :O "><div id="in" style="position:relative">');
for (i=0; i < amount; i++)
{
if (document.all)
{
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="msieBats" style="position:absolute;top:-50;leftBlush | :O " border=0></a>')

}
else
document.write('<a href="http://www.dynamicdrive.com"><img src="'+Cupid.src+'" id="ns6Bats'+i+'" width=69 height=60 style="position:absolute;top:-50;leftBlush | :O " border=0></a>')
}
document.write('</div></div>');
}


if (document.layers||ns6)
{

yBase=window.innerHeight/3;
xBase=window.innerWidth/6;
if (document.layers)
window.captureEvents(Event.MOUSEMOVE);
}
if (document.all)
{

yBase = window.document.body.offsetHeight/3;
xBase = window.document.body.offsetWidth/6;
}



if (document.layers)
{
for (i=0; i < amount; i++)
document.layers['m'+i].document.images['nsi'].src=Cupid.src
}
else if (document.all)
{

for (i=0; i < amount; i++)
{
document.all.msieBats[i].src=Cupid.src
//alert('start in if6');
}
}
else if (ns6)
{
for (i=0; i < amount; i++)
document.getElementById("ns6Bats"+i).src=Cupid.src
}


}
//
function Animate()
{

a_count+=move;
b_count+=move;
c_count+=move;
currStep+=step;
if (a_count >= bats.length) a_count=0;
if (b_count >= bats.length) b_count=0;
if (c_count >= bats.length) c_count=0;
if (document.layers)
{
for (i=0; i < amount; i++)
{
var NewL="n"+i
document.layers[NewL].top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.layers[NewL].left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}

if (document.all){

for (i=0; i < amount; i++)
{
document.all.msieBats[i].style.pixelTop = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.all.msieBats[i].style.pixelLeft =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}
if (ns6)
{
for (i=0; i < amount; i++)
{
document.getElementById("ns6Bats"+i).style.top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
document.getElementById("ns6Bats"+i).style.left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
}
}
}

function moveToClick(evt) {
loaded =false;
evt = (evt) ? evt : event;

dismisscupid();
//cleanUP();

flycupid=setInterval('Animate()',30);

}

function startup() {

flycupid=setInterval('Animate()',30);


//dismisscupid
//setTimeout("dismisscupid()",3*1000);


}
window.onload = startup;
document.onmousedown = moveToClick;

//-->
</script>
</body>
</html>
but this doesn'tachieve the 3rd funcion.Can anybody tell me wht's wrong with this script.
Questioncan more than one form be submitted at one time? Pin
nicksun9-Nov-04 16:38
nicksun9-Nov-04 16:38 
AnswerRe: can more than one form be submitted at one time? Pin
rgoyal9-Nov-04 20:53
rgoyal9-Nov-04 20:53 
AnswerRe: can more than one form be submitted at one time? Pin
rgoyal9-Nov-04 21:18
rgoyal9-Nov-04 21:18 
GeneralRe: can more than one form be submitted at one time? Pin
nicksun10-Nov-04 5:34
nicksun10-Nov-04 5:34 
GeneralRe: can more than one form be submitted at one time? Pin
Anonymous10-Nov-04 17:45
Anonymous10-Nov-04 17:45 
QuestionStrong name assembly in html page? Pin
fridtjof9-Nov-04 9:42
fridtjof9-Nov-04 9:42 
AnswerAdditional information for the problem Pin
fridtjof9-Nov-04 21:42
fridtjof9-Nov-04 21:42 
Generalasp sessions Pin
mm668-Nov-04 9:42
mm668-Nov-04 9:42 
GeneralRe: asp sessions Pin
hakanaktan8-Nov-04 14:52
hakanaktan8-Nov-04 14:52 
Generalsecure web pages and images Pin
seevse8-Nov-04 8:23
seevse8-Nov-04 8:23 
GeneralRe: secure web pages and images Pin
JKroschel2-Dec-04 11:33
JKroschel2-Dec-04 11:33 
GeneralChanging References quickly Pin
sharkbait8-Nov-04 3:58
sharkbait8-Nov-04 3:58 
GeneralSigning a javascript block Pin
JonasSyrstad8-Nov-04 0:41
JonasSyrstad8-Nov-04 0:41 
GeneralChange date format in javascript Pin
R. Thomas7-Nov-04 5:40
R. Thomas7-Nov-04 5:40 
GeneralRe: Change date format in javascript Pin
Ted Ferenc7-Nov-04 6:27
Ted Ferenc7-Nov-04 6:27 
GeneralRe: Change date format in javascript Pin
R. Thomas7-Nov-04 13:02
R. Thomas7-Nov-04 13:02 
GeneralRe: Change date format in javascript Pin
Ted Ferenc7-Nov-04 21:36
Ted Ferenc7-Nov-04 21:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.