Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-19-2008, 03:58 PM   PM User | #1
ClueLess
Regular Coder

 
Join Date: Nov 2002
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
ClueLess is an unknown quantity at this point
Passing ASP code in the Javacript for disable and enble fields

I'm having this Onchange javascript works just fine for HTML, but how can we use RS asp in it?

If RS("MainSelID") = 1 or 3 we would like to disable other select fields. If the user selects other numbers than enble other select fields

Code:
<script language="JavaScript">
    
     function ShowHide(box){
        //disable & enble
       // var SID ='<%=RS("MainSelID")%>'
        
         var SID=box.id="MainS";

        if(SID && box.selectedIndex == '1' || SID && box.selectedIndex == '3'){
            document.getElementById('Select1').disabled=true
            document.getElementById('Select2').disabled=true
        }
        else{
            document.getElementById('Select1').disabled=false
            document.getElementById('Select2').disabled=false
        }
        }
</script>

<form name="theForm" action="Submit.asp" onsubmit="return Validator(this)">

<select id="MainS" onchange="ShowHide(this)">
<option value="0">Main Sectect</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>

<!--<option selected value=""></option>
   <%Do While Not RS.EOF  %>
       <option value="<%=RS("MainSelID")%>"><%=RS("MainSelID")%></option>
    <%RSValIntent.MoveNext()
    Loop
' RS.close-->
</select>

<select id="Select1">
<option value="0">Select1</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

<select id="Select2">
<option value="0">Select2 me</option>
<option value="1">1</option>
<option value="2">2</option>
</select>


 <br /><br />
      <input type="Submit" value="Submit" name="submit">
</form>
ClueLess is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:20 PM.


Advertisement
Log in to turn off these ads.