Click to See Complete Forum and Search --> : Can this button .....
Tasmanian Devil
05-30-2003, 08:12 PM
Can this button tick messages?
<script type="text/javascript">
function Process(obj){
var frm = document.getElementById("form1");
var len = frm.length;
if(obj.value=="Show Menu"){
document.getElementById('menuFrame').style.visibility='visible';
obj.value="Hide Menu"
}else if(obj.value=="Hide Menu"){
document.getElementById('menuFrame').style.visibility='hidden';
obj.value="Show Menu"
}
}
</script>
<form id="form1" action="" onsubmit="">
<input type="button" value="Show Menu" onclick="Process(this);"/>
</form>
I would code it as follows:
<script type="text/javascript">
function Process(obj, frm){
var len = frm.elements.length;
if(obj.value=="Show Menu"){
document.getElementById('menuFrame').style.visibility='visible';
obj.value="Hide Menu"
}else if(obj.value=="Hide Menu"){
document.getElementById('menuFrame').style.visibility='hidden';
obj.value="Show Menu"
}
}
</script>
<form name="form1" action="" onsubmit="">
<input type="button" value="Show Menu" onclick="Process(this, this.form);"/>
</form>
Jona
Tasmanian Devil
05-30-2003, 08:31 PM
Jona~
That script did not work, I need it to tick four or five messages if possible.
Thanks
I misunderstand you. What is the question here? I thought you were asking how to better code what you posted. And what you posted did have a few things that would cause errors.
What are you trying to do?
Jona
Tasmanian Devil
05-30-2003, 08:38 PM
Jona~
Sorry about that. I need the button to tick five (for example) messages like a ticker would. Or better maybe like a scoller would but in the button.
Thanks
You want the text to scroll from left to right on the button? Or do you want the text in the button to change every time you click it and after 5 times reset to default?
Jona
Tasmanian Devil
05-30-2003, 08:47 PM
Jona~
I need the text to scroll left to right but prefer down to up in the button.
Thanks
This doesn't scroll, but it moves..
<script type="text/javascript">
var butVal = "abcdefghijklmnopqrstuvwxyz";
var len = butVal.split("");
var i = 0; var setClear;
function scrollObj(){
obj=document.forms[0].elements[0];
if(i==0) obj.value=""; obj.style.width=50+len.length*10;
obj.value+=len[i];
i++;
if(i==len.length){i=0;}
setClear = setTimeout("scrollObj()", 100);
}
</script>
<form name="form1" action="" onsubmit="">
<input type="button" value="Show Scroller" onclick="scrollObj();">
</form>
Jona
Also, the script works in IE6, Mozilla 1.3, and Netscape 6.2.
Jona
This types from left to right.
<script type="text/javascript">
var butVal = "abcdefghijklmnopqrstuvwxyz";
var len = butVal.split("");
var i = 0; var setClear;
function scrollObj(){
obj=document.forms[0].elements[0];
if(i==0){obj.value=" "; obj.style.textAlign="left";}
obj.value+=len[i];
i++;
if(i==len.length){i=0;}
setClear = setTimeout("scrollObj()", 100);
}
</script>
<form name="form1" action="" onsubmit="">
<input type="button" value="Show Scroller" onclick="scrollObj();">
</form>
Jona
Tasmanian Devil
05-30-2003, 09:28 PM
Jona~
Thanks for the help. I am a big idiot when it comes to javascript.
Thanks again