Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Syntax for ASP/Javascript page

I have the code below for an ASP/VB page, in that enviroment it detects if ipad is being used and depending on the condition displays content. I need this for an ASP/Javascript page

-- code --

Function isIPad()
    If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "iPad") > 0 Then
        isIPad = True
    Else
        isIPad = False
    End If
End Function

<%If isIPad() then%>
    Code for text field here
<%Else%>
    Code for HTML editor here
<%End If%>

----

Thanks.
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Microsoft JScript compilation error '800a03ec'

Expected ';'

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 495

If ( isIPad() ) {

---- line 496 is:

<%If ( isIPad() ) { %>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Still get the same error, this is all my code in those lines:

 <%if ( isIPad() ) { %>
        <label for="Comments"></label>
        <textarea name="Comments" cols="50" rows="8" id="Comments"><% if (!Lettrmrg.EOF || !Lettrmrg.BOF) { %> <%=(Lettrmrg.Fields.Item("LtrBody").Value)%>  <% } // end !Lettrmrg.EOF || !Lettrmrg.BOF %>  
        </textarea>
<% } Else { %>
     <textarea id="Comments" name="Comments" class="dmxEditor" style="width:600px;height:300px"><% if (!Lettrmrg.EOF || !Lettrmrg.BOF) { %> <%=(Lettrmrg.Fields.Item("LtrBody").Value)%>  <% } // end !Lettrmrg.EOF || !Lettrmrg.BOF %>  
</textarea>
<script type="text/javascript">
  // <![CDATA[
 jQuery(document).ready(
   function()
     {
       jQuery("#Comments").dmxEditor(
         {}
       );
     }
 );
  // ]]>
</script>
<% } %>

---

Error:

Microsoft JScript compilation error '800a03ec'

Expected ';'

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 288

Function isIPad()
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

That worked but now i get this:  

Microsoft JScript compilation error '800a03f0'

Expected '{'

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 289

var userAgent = Request.ServerVariables("HTTP_USER_AGENT");
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

'function' and 'if' were in caps, took care of that. that part of the code seems to be ok.
Now .. where we display the content based on the values i get this error:

Microsoft JScript compilation error '800a03ec'

Expected ';'

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 512

} Else {


----- this is the code where my content is displayed:  ---

 <%if ( isIPad() ) { %>
        <label for="Comments"></label>
        <textarea name="Comments" cols="50" rows="8" id="Comments"><% if (!Lettrmrg.EOF || !Lettrmrg.BOF) { %> <%=(Lettrmrg.Fields.Item("LtrBody").Value)%>  <% } // end !Lettrmrg.EOF || !Lettrmrg.BOF %>  
        </textarea>
<% } Else { %>
     <textarea id="Comments" name="Comments" class="dmxEditor" style="width:600px;height:300px"><% if (!Lettrmrg.EOF || !Lettrmrg.BOF) { %> <%=(Lettrmrg.Fields.Item("LtrBody").Value)%>  <% } // end !Lettrmrg.EOF || !Lettrmrg.BOF %>  
</textarea>
<script type="text/javascript">
  // <![CDATA[
 jQuery(document).ready(
   function()
     {
       jQuery("#Comments").dmxEditor(
         {}
       );
     }
 );
  // ]]>
</script>
<% } %>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

that fixed that but now i get this:

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 291

--- line 291 is:

    if ( userAgent.indexOf("iPad") > 0 ) Then

which takes us back to the first code, it is as of now:

<%
function isIPad() {
    var userAgent = Request.ServerVariables("HTTP_USER_AGENT");
    var isIpad = false;
    if ( userAgent.indexOf("iPad") > 0 ) Then
        isIPad = true;

    return isIpad;

}
%>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Same error same line:

    if ( userAgent.indexof("iPad") > 0 ) Then

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 291
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Same error  :(
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

I see that ... still with that i get an error.

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 291
 
Same line of code.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

<%
function isIPad() {
    var userAgent = Request.ServerVariables("HTTP_USER_AGENT");
    var isIpad = false;
    if ( userAgent.indexOf("iPad") > 0 )
        isIPad = true;

    return isIpad;

}
%>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

No, instead I get this error:

Microsoft JScript runtime error '800a138f'

Object expected

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 291
Avatar of Aleks

ASKER

btw .. line 291 would be:

    alert(userAgent);
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

still get this:

Microsoft JScript runtime error '800a138f'

Object expected

/bluedot/Intranet/Cases/Commentspop/AddComments.asp, line 289
Avatar of Aleks

ASKER

Like this ?

<%
function isIPad() {
alert( Request.ServerVariables("HTTP_USER_AGENT") );
    var isIpad = false;
alert( Request.ServerVariables("HTTP_USER_AGENT") );
    if ( userAgent.indexOf("iPad") > 0 )
        isIPad = true;

    return isIpad;

}
%>

Also gives an error
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial