Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem:oggling a button..

Status
Not open for further replies.

bugeditor

Technical User
Oct 9, 2001
44
IN
I Have a toggle button on browser

I will be toggling the button with the following code

function toggle(){
if (window.button1.value == 'Automatic')
{
window.button1.value = 'Manual';
}
else
{
window.button1.value = 'Automatic';
}
}

I have also next url ..

The above button default value = 'Automatic'..Everything working fine but when i say next url..the button value also changing to automatic which is default and which should not happen untill i press the toggle to change value..

Can anybody help me with a snippet..How can I keep the value of the button as it is..untill i press the button..i.e.if i say next url..the value should remain Manual only..as it is..

Thanks
 
Hello, BugEditor.

I guess your nextURL do something, but not a clue of what. So I use the similar toggle function for it as an illustration in the html page below. See if it shows the essential ingredient to solve your problem.

regards - tsuji

------------------------------------------
<HTML><HEAD><TITLE>329-151519</TITLE>
</HEAD>
<BODY>
<form name=&quot;formbutton&quot;>
<input type=&quot;button&quot; size=&quot;30&quot; name=&quot;button1&quot; value=&quot;Automatic&quot;/><br><br>
<input type=&quot;button&quot; size=&quot;30&quot; name=&quot;button2&quot; value=&quot;nextURL&quot;/>
</form>
<script language=&quot;Javascript&quot;>
<!--
function toggle(){
if (document.formbutton.button1.value == 'Automatic') {
document.formbutton.button1.value = 'Manual';
}
else {
document.formbutton.button1.value = 'Automatic';
}
}
function toggle2() {
if (document.formbutton.button2.value == &quot;nextURL&quot;) {
document.formbutton.button2.value = 'prevURL';
}
else {
document.formbutton.button2.value = 'nextURL';
}
}
document.formbutton.button1.onclick = toggle;
document.formbutton.button2.onclick = toggle2;
//-->
</script>
</BODY></HTML>
------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top