Newbie question - VBScript in IE 
Author Message
 Newbie question - VBScript in IE

I'm trying to set a behavior in IE where text box #2 is disabled and
greyed-out until something has been entered into text box #1. I use VBScript
in ASP but have no knowledge of using it in a browser. I would be very
grateful if someone could look at my code and tell me where i'm going wrong,
THANKS!:-

*IN THE HEAD OF THE DOCUMENT*

<SCRIPT FOR=window EVENT=onload LANGUAGE="VBScript">

  Dim TheForm
  Set TheForm = Document.forms("ValidForm")

  If Len(TheForm.oExample1.Value) = 0 Then
    TheForm.oExample2.disabled = true
    TheForm.oExample2.style.backgroundColor = "inactiveborder"
  End If

</SCRIPT>

*IN THE BODY OF THE DOCUMENT*

<SCRIPT LANGUAGE="VBScript">
<!--
Sub Validate

  If Len(TheForm.oExample1.Value) = 0 Then
    TheForm.oExample2.disabled = true
    TheForm.oExample2.style.backgroundColor = "inactiveborder"
  Else
    TheForm.oExample2.disabled = false
    TheForm.oExample2.style.backgroundColor = "white"
  End If

End Sub
-->
</SCRIPT>

*IN THE FORM ITSELF*

<form ID="ValidForm" name="ValidForm" method="get" action="search.asp">
   <input type="text" name="txt1a" ID="oExample1" onkeyup="Validate()">
   <input type="text" ID="oExample2" name="txt2a">
</form>

Thanks,

Martin.



Tue, 16 Mar 2004 18:22:11 GMT  
 Newbie question - VBScript in IE
Problem solved



Quote:
> I'm trying to set a behavior in IE where text box #2 is disabled and
> greyed-out until something has been entered into text box #1. I use
VBScript
> in ASP but have no knowledge of using it in a browser. I would be very
> grateful if someone could look at my code and tell me where i'm going
wrong,
> THANKS!:-

> *IN THE HEAD OF THE DOCUMENT*

> <SCRIPT FOR=window EVENT=onload LANGUAGE="VBScript">

>   Dim TheForm
>   Set TheForm = Document.forms("ValidForm")

>   If Len(TheForm.oExample1.Value) = 0 Then
>     TheForm.oExample2.disabled = true
>     TheForm.oExample2.style.backgroundColor = "inactiveborder"
>   End If

> </SCRIPT>

> *IN THE BODY OF THE DOCUMENT*

> <SCRIPT LANGUAGE="VBScript">
> <!--
> Sub Validate

>   If Len(TheForm.oExample1.Value) = 0 Then
>     TheForm.oExample2.disabled = true
>     TheForm.oExample2.style.backgroundColor = "inactiveborder"
>   Else
>     TheForm.oExample2.disabled = false
>     TheForm.oExample2.style.backgroundColor = "white"
>   End If

> End Sub
> -->
> </SCRIPT>

> *IN THE FORM ITSELF*

> <form ID="ValidForm" name="ValidForm" method="get" action="search.asp">
>    <input type="text" name="txt1a" ID="oExample1" onkeyup="Validate()">
>    <input type="text" ID="oExample2" name="txt2a">
> </form>

> Thanks,

> Martin.



Tue, 16 Mar 2004 20:51:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. EDatabaseError

2. :ADABAS+DELPHI

3. Newbie question - VBScript in IE

4. Newbie Question - How to use IE with WScript

5. Newbie question: Quit IE after printing is done

6. Newbie question: IE style buttons

7. Newbie: VB6/Visual Studio/IE Install questions

8. Newbie: VB6/Visual Studio/IE Install questions

9. Error 80010108 starting IE from VBScript with prior IE instances open

10. VBScript, ADO, ASP: Yet Another Stupid Newbie Question

11. DELTREE in VBScript and other newbie questions.

12. Newbie question : string manipulation with VBscript.

 

 
Powered by phpBB® Forum Software