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!

Can you remove the button?

Status
Not open for further replies.

Diego1

Technical User
Feb 27, 2001
3
GB
I have this script working fine, in IE and NS, except that I wish to lose the button and have it 'go' when the selection is made..rather than when the user hits the button..

(( I have indcluded
Code:
as some forums use this to keep the format of the script. It is not part of the script and should be disregarded if it does not work here...))

Code:
<html>
<head>
	<title>Untitled</title>
	
	<script language=&quot;JavaScript&quot;>

<!--
function go_to_station(){
        if (document.stationform.stationselect.options[0].selected){
                window.location.href = &quot;mailto:user@domain&quot;;} 
        else if (document.stationform.stationselect.options[1].selected)                
        {       window.location.href = &quot;mailto:user@domain&quot;;}
        else if (document.stationform.stationselect.options[2].selected)                
        {       window.location.href = &quot;mailto:user@domain&quot;;}   
        else if (document.stationform.stationselect.options[3].selected)                
        {       window.location.href = &quot;mailto:user@domain&quot;;}    
        else if (document.stationform.stationselect.options[4].selected)                
        {       window.location.href = &quot;mailto:user@domain&quot;;}   
                
        return true;    
        }

function textValue(){   
        var stationInteger, stationString       
        stationInteger=document.stationform.stationselect.selectedIndex 
        stationString=document.stationform.stationselect.options[stationInteger].text   
        document.stationform.stationtext.value = &quot;Go!&quot;  
         }

//-->


</script>
</head>

<body>

<form name=&quot;stationform&quot;>
<select name=&quot;stationselect&quot; onChange=&quot;textValue()&quot; size=&quot;1&quot;>
<option>selection1
<option>selection2
<option>selection3
<option>selection4
<option>selection5 
 
</select>

<p>

<input type=&quot;button&quot; name=&quot;stationtext&quot; value=&quot;&quot; onClick=&quot;go_to_station()&quot;>

</form>
</body>
</html>
 
That should have read:

(( I have included [ code ] [ /code ] as some forums use this to keep the format of the script. It is not part of the script and should be disregarded if it does not work here...))

And I am happy to see this forum does infact use it...

Ta

Ð
 
kinda confused, but try this:

function textValue(){
var stationInteger, stationString
stationInteger=document.stationform.stationselect.selectedIndex
stationString=document.stationform.stationselect.options[stationInteger].text
document.stationform.stationtext.value = &quot;Go!&quot;
if (document.stationform.stationselect.options[0].selected){
window.location.href = &quot;mailto:user@domain&quot;;}
else if (document.stationform.stationselect.options[1].selected)
{ window.location.href = &quot;mailto:user@domain&quot;;}
else if (document.stationform.stationselect.options[2].selected)
{ window.location.href = &quot;mailto:user@domain&quot;;}
else if (document.stationform.stationselect.options[3].selected)
{ window.location.href = &quot;mailto:user@domain&quot;;}
else if (document.stationform.stationselect.options[4].selected)
{ window.location.href = &quot;mailto:user@domain&quot;;}

return true;

}


i just put everything in textValue... is that what you wanted, to not have to use the button at all? jaredn@subdimension.com -
 
Ys, but I did try that and while it works in NS, it does nothing at all in IE...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top