?
Solved

elseif syntax?

Posted on 2012-03-27
6
Medium Priority
?
339 Views
Last Modified: 2012-04-30
Can someone please help me understand why this gives me an error and how to correct it?

<iframe name="main" width="89%" height="100%" align="right" frameborder="0" style="background-color:#FFFFFF; overflow:hidden;" src="<% If Request.querystring("loadCurrent") = 1 Then Response.write "EditCurrent.asp" ElseIf Request.querystring("loadCurrent") = 2 Then Response.write "main.htm" Else Response.write "main.htm" End If %>"></iframe>

Open in new window


ERROR:
Microsoft VBScript compilation error '800a0401' 

Expected end of statement 

/corpcardnew/Default.asp, line 64 

If Request.querystring("loadCurrent") = 1 Then Response.write "EditCurrent.asp" ElseIf Request.querystring("loadCurrent") = 2 Then Response.write "main.htm" Else Response.write "main.htm" End If
--------------------------------------------------------------------------------^

Open in new window

0
Comment
Question by:Ahelbling
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37773085
Remove   Response.write.
i mean replace the line
 Response.write "EditCurrent.asp"
with only
"EditCurrent.asp"
0
 

Author Comment

by:Ahelbling
ID: 37773098
that didnt seem to work...


Microsoft VBScript compilation error '800a0400'

Expected statement

/corpcardnew/Default.asp, line 64

If Request.querystring("loadCurrent") = 1 Then "EditCurrent.asp" ElseIf Request.querystring("loadCurrent") = 2 Then "main.htm" Else "main.htm" End If
-----------------------------------------------^
0
 

Author Comment

by:Ahelbling
ID: 37773102
are the double quotes around "EditCurrent.asp"  possibly breaking this?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Accepted Solution

by:
Big Monty earned 668 total points
ID: 37773212
i would write out the code like this, its a lot more readable:

<% 
If Request.querystring("loadCurrent") = 1 Then 
    src = "EditCurrent.asp" 
ElseIf Request.querystring("loadCurrent") = 2 Then 
    src = "main.htm" 
Else 
    src = "main.htm" 
End If 
%>

<iframe name="main" width="89%" height="100%" align="right" frameborder="0" style="background-color:#FFFFFF; overflow:hidden;" src="<%=src%>" ></iframe>

Open in new window

0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 664 total points
ID: 37773289
VBscript wants it to be a multi-line coding like The_Big_Daddy shows above.  The end of line means something to the VBscript parser and it's missing when you try to put it all on one line like you have.  That's what the error "Expected end of statement " in your original post is referring to.
0
 
LVL 5

Assisted Solution

by:Seonyx
Seonyx earned 668 total points
ID: 37775586
You can separate commands on one line with a colon. Also good practice to only call your request variable once. Use the select case statement as it is more suitable in this situation. Try this:
<iframe name="main" width="89%" height="100%" align="right" frameborder="0" style="background-color:#FFFFFF; overflow:hidden;" src="<% Dim loadcurrentresponse:loadcurrentresponse = Request.querystring("loadCurrent"):select case loadcurrentresponse:case "1":response.write("EditCurrent.asp"):case else:response.write("main.htm"):End select%>"></iframe>

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question