byteslinger
asked on
How can I get this to work with a submit button?
I have several functions that are operating off a submit button, but basically I need this one to work, and it doesn't seem to like anything but an "input type='button'"
Is there any way to make it work with a button type of "submit"???
<html>
<head>
<style>
.button2 { border:outset 2px; font-size:11px; background:#FAE6BF; color:blue;}
</style>
<script language="javascript">
var time_now = new Date();
function blink_the_buttons(){
temp_now = new Date();
check = temp_now - time_now;
for (i=0;i<blink_buttons.lengt h;i++){
if ((blink_buttons[i][2] * blink_buttons[i][3]) < check){
obj = eval(blink_buttons[i][0]);
blink_buttons[i][3] = blink_buttons[i][3] + 1;
if (blink_buttons[i][4] == true){
obj.value = "";
blink_buttons[i][4] = false;
} else {
obj.value = blink_buttons[i][1];
blink_buttons[i][4] = true;
}
}
}
setTimeout("blink_the_butt ons()",0);
}
</script>
</head>
<body>
<form name=myform>
<input class="button2" type=button value="Second blinking text" name=processing style="width:150;" onclick="blink_the_buttons ();">
</form>
</body>
</html>
<script language="javascript">
var blink_buttons = new Array();
blink_buttons[0] = new Array(document.myform.proc essing,"Se cond blinking text",400,0,true);
</script>
Is there any way to make it work with a button type of "submit"???
<html>
<head>
<style>
.button2 { border:outset 2px; font-size:11px; background:#FAE6BF; color:blue;}
</style>
<script language="javascript">
var time_now = new Date();
function blink_the_buttons(){
temp_now = new Date();
check = temp_now - time_now;
for (i=0;i<blink_buttons.lengt
if ((blink_buttons[i][2] * blink_buttons[i][3]) < check){
obj = eval(blink_buttons[i][0]);
blink_buttons[i][3] = blink_buttons[i][3] + 1;
if (blink_buttons[i][4] == true){
obj.value = "";
blink_buttons[i][4] = false;
} else {
obj.value = blink_buttons[i][1];
blink_buttons[i][4] = true;
}
}
}
setTimeout("blink_the_butt
}
</script>
</head>
<body>
<form name=myform>
<input class="button2" type=button value="Second blinking text" name=processing style="width:150;" onclick="blink_the_buttons
</form>
</body>
</html>
<script language="javascript">
var blink_buttons = new Array();
blink_buttons[0] = new Array(document.myform.proc
</script>
ASKER
so you're saying there's no way to pass data and still have the button blink?
the reason I want this to work is because the submission process can take several seconds, and I want to use this method to inform the user that something's happening.
the reason I want this to work is because the submission process can take several seconds, and I want to use this method to inform the user that something's happening.
So you want to blink while the submit is getting it's act in gear? In otherwords, you *do* want to submit, but there's a delay.
function blink_the_buttons(f){
// code for blink_the_buttons
f.submit();
}
with
<form name="myform">
<input class="button2" type=button value="Second blinking text" name=processing style="width:150;" onclick="blink_the_buttons (this.form );">
</form>
OR
function blink_the_buttons(){
// code for blink_the_buttons
return true;
}
with
<form name=myform onsubmit="return blink_the_buttons()">
<input class="button2" type=submit value="Second blinking text" name=processing style="width:150;" >
</form>
function blink_the_buttons(f){
// code for blink_the_buttons
f.submit();
}
with
<form name="myform">
<input class="button2" type=button value="Second blinking text" name=processing style="width:150;" onclick="blink_the_buttons
</form>
OR
function blink_the_buttons(){
// code for blink_the_buttons
return true;
}
with
<form name=myform onsubmit="return blink_the_buttons()">
<input class="button2" type=submit value="Second blinking text" name=processing style="width:150;" >
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! Thanks for the hint! Here's the finished product (sort of)
<html>
<head><title></title>
<style>
.button2 { border:outset 2px; font-size:11px; background:#FAE6BF; color:blue;}
</style>
<script language="javascript">
<!--
var time_now = new Date();
function blinkIt(){
temp_now = new Date();
check = temp_now - time_now;
for (i=0;i<blink_buttons.lengt h;i++){
if ((blink_buttons[i][2] * blink_buttons[i][3]) < check){
obj = eval(blink_buttons[i][0]);
blink_buttons[i][3] = blink_buttons[i][3] + 1;
if (blink_buttons[i][4] == true){
obj.value = "";
blink_buttons[i][4] = false;
} else {
obj.value = blink_buttons[i][1];
blink_buttons[i][4] = true;
}
}
}
setTimeout("blinkIt()",0);
}
function mysubmit(f) {
f.submit();
blinkIt();
}
//-->
</script>
</head>
<body>
<form name=myform action="http://bigslowpage.com">
<input class="button2" type="button" value="Submit" name=processing style="width:150;" onclick="mysubmit(this.for m);">
</form>
<script language="javascript">
var blink_buttons = new Array();
blink_buttons[0] = new Array(document.myform.proc essing,"Su bmitting.. .",500,0,t rue);
</script>
</body>
</html>
<html>
<head><title></title>
<style>
.button2 { border:outset 2px; font-size:11px; background:#FAE6BF; color:blue;}
</style>
<script language="javascript">
<!--
var time_now = new Date();
function blinkIt(){
temp_now = new Date();
check = temp_now - time_now;
for (i=0;i<blink_buttons.lengt
if ((blink_buttons[i][2] * blink_buttons[i][3]) < check){
obj = eval(blink_buttons[i][0]);
blink_buttons[i][3] = blink_buttons[i][3] + 1;
if (blink_buttons[i][4] == true){
obj.value = "";
blink_buttons[i][4] = false;
} else {
obj.value = blink_buttons[i][1];
blink_buttons[i][4] = true;
}
}
}
setTimeout("blinkIt()",0);
}
function mysubmit(f) {
f.submit();
blinkIt();
}
//-->
</script>
</head>
<body>
<form name=myform action="http://bigslowpage.com">
<input class="button2" type="button" value="Submit" name=processing style="width:150;" onclick="mysubmit(this.for
</form>
<script language="javascript">
var blink_buttons = new Array();
blink_buttons[0] = new Array(document.myform.proc
</script>
</body>
</html>
setTimeout("blink_the_butt
return false;
}
<form name=myform onsubmit="return blink_the_buttons();">