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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable undefined

Status
Not open for further replies.

cat5ive

MIS
Joined
Dec 3, 2004
Messages
184
Location
US
Hi,

I got error message 'strReason is undefined'. What I'm tring to to is read xml data using vbscript. If string strReason is not blank then use javascript to pop up the alert box.

Thank in advance
Code:
<%
   
strReason = ReadXML (xmldoc, "//recordnotavailable")
 %>
 <script type="text/javascript">  
  <!--
  
    if (strReason != "") 
    {
       alert(strReason);
       window.location("mv_ap_maint.asp");
    }
      
  -->
  </script>
 
You're mixing server side and client side code. To accomplish what you want, you need to change your code to this:
Code:
<script type="text/javascript">  
<!--
var strReason = '<%=ReadXML (xmldoc, "//recordnotavailable")
 %>';
  
if (strReason != "") 
  {
  alert(strReason);
  window.location("mv_ap_maint.asp");
  }
      
-->
</script>

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top