Aleks
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.ServerVariab les("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.
-- code --
Function isIPad()
If InStr(Request.ServerVariab
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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").dmxEdi tor(
{}
);
}
);
// ]]>
</script>
<% } %>
---
Error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/bluedot/Intranet/Cases/Co mmentspop/ AddComment s.asp, line 288
Function isIPad()
<%if ( isIPad() ) { %>
<label for="Comments"></label>
<textarea name="Comments" cols="50" rows="8" id="Comments"><% if (!Lettrmrg.EOF || !Lettrmrg.BOF) { %> <%=(Lettrmrg.Fields.Item("
</textarea>
<% } Else { %>
<textarea id="Comments" name="Comments" class="dmxEditor" style="width:600px;height:
</textarea>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#Comments").dmxEdi
{}
);
}
);
// ]]>
</script>
<% } %>
---
Error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/bluedot/Intranet/Cases/Co
Function isIPad()
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked but now i get this:
Microsoft JScript compilation error '800a03f0'
Expected '{'
/bluedot/Intranet/Cases/Co mmentspop/ AddComment s.asp, line 289
var userAgent = Request.ServerVariables("H TTP_USER_A GENT");
Microsoft JScript compilation error '800a03f0'
Expected '{'
/bluedot/Intranet/Cases/Co
var userAgent = Request.ServerVariables("H
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/Co mmentspop/ AddComment s.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").dmxEdi tor(
{}
);
}
);
// ]]>
</script>
<% } %>
Now .. where we display the content based on the values i get this error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/bluedot/Intranet/Cases/Co
} 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("
</textarea>
<% } Else { %>
<textarea id="Comments" name="Comments" class="dmxEditor" style="width:600px;height:
</textarea>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#Comments").dmxEdi
{}
);
}
);
// ]]>
</script>
<% } %>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/Co mmentspop/ AddComment s.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("H TTP_USER_A GENT");
var isIpad = false;
if ( userAgent.indexOf("iPad") > 0 ) Then
isIPad = true;
return isIpad;
}
%>
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/bluedot/Intranet/Cases/Co
--- 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("H
var isIpad = false;
if ( userAgent.indexOf("iPad") > 0 ) Then
isIPad = true;
return isIpad;
}
%>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/Co mmentspop/ AddComment s.asp, line 291
if ( userAgent.indexof("iPad") > 0 ) Then
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/bluedot/Intranet/Cases/Co
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Same error :(
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/Co mmentspop/ AddComment s.asp, line 291
Same line of code.
Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/bluedot/Intranet/Cases/Co
Same line of code.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<%
function isIPad() {
var userAgent = Request.ServerVariables("H TTP_USER_A GENT");
var isIpad = false;
if ( userAgent.indexOf("iPad") > 0 )
isIPad = true;
return isIpad;
}
%>
function isIPad() {
var userAgent = Request.ServerVariables("H
var isIpad = false;
if ( userAgent.indexOf("iPad") > 0 )
isIPad = true;
return isIpad;
}
%>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No, instead I get this error:
Microsoft JScript runtime error '800a138f'
Object expected
/bluedot/Intranet/Cases/Co mmentspop/ AddComment s.asp, line 291
Microsoft JScript runtime error '800a138f'
Object expected
/bluedot/Intranet/Cases/Co
ASKER
btw .. line 291 would be:
alert(userAgent);
alert(userAgent);
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
still get this:
Microsoft JScript runtime error '800a138f'
Object expected
/bluedot/Intranet/Cases/Co mmentspop/ AddComment s.asp, line 289
Microsoft JScript runtime error '800a138f'
Object expected
/bluedot/Intranet/Cases/Co
ASKER
Like this ?
<%
function isIPad() {
alert( Request.ServerVariables("H TTP_USER_A GENT") );
var isIpad = false;
alert( Request.ServerVariables("H TTP_USER_A GENT") );
if ( userAgent.indexOf("iPad") > 0 )
isIPad = true;
return isIpad;
}
%>
Also gives an error
<%
function isIPad() {
alert( Request.ServerVariables("H
var isIpad = false;
alert( Request.ServerVariables("H
if ( userAgent.indexOf("iPad") > 0 )
isIPad = true;
return isIpad;
}
%>
Also gives an error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Expected ';'
/bluedot/Intranet/Cases/Co
If ( isIPad() ) {
---- line 496 is:
<%If ( isIPad() ) { %>