Subject: calculator.asp
Posted By: dennisskinner Post Date: 8/15/2006 3:55:22 PM
Hello   How do I add my code to this without having to enter all 102 lines.  thanks dls
Reply By: Imar Reply Date: 8/15/2006 4:02:00 PM
Heuh? Add code to what? What 102 lines?

Can you please specify a book version, chapter number and page number and elaborate a bit about the problem you're having?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: dennisskinner Reply Date: 8/15/2006 4:47:29 PM
Hi  I went back and redid the chap 7 items in dreamweaver mx 2004.  I finished the calculator.asp item on page 258.  When I try f12 after putting the file, I get a page can't be displayed and it states that I have a 500.100 http,  internal server error asp error iis.  so I wanted to include the code for review.  when i hit the # sign I get what looks like html in the page, like this -
  So my question is, what is the method for including the actual code without entering it as it's 102 lines.  Or is it necessary to enter it and is it possible to just attach the file somehow.  thanks dls
Reply By: Imar Reply Date: 8/16/2006 1:12:32 AM
You can simply copy and paste the code here.

For readability, please enclose it in code tags (with the # symbol you described) and add linebreaks to layout your code so the page doesn't get too wide. Use the Preview button to see how your post will end up.

The code you saw does indeed look like HTML, but is replaced with actual HTML when the page is viewed.

Also, try this:

1. Open Internet Explorer
2. Choose Tools | Options
3. Switch to the Advanced tab
4. Look for an option called Display Friendly HTTP Errors or something like that and make sure it's not selected.
5. Run your asp page again. You should get more details about the error.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: dennisskinner Reply Date: 8/18/2006 9:33:35 AM
Hi Ian     I unchecked http friendly messages, f12'ed the calculator asp and got a similar screen.  code follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
 Dim dblResult
 Dim dblNumber1
 Dim dblNumber2
 If Request.Form("btnCalculate") <> "" Then
   dblNumber1 = CDbl(Request.Form("txtNumber1"))
   dblNumber2 = CDbl(Request.form("txtNumber2"))
   Select Case Request Request.form("1stOperator")
     Case "+"
     dblResult = dblNumber1 + dblNumber2
     Case "-"
     dblResult = dblNumber1 - dblNumber2
     Case "*"
     dblResult = dblNumber1 * dblNumber2
     Case "/"
     dblResult = dblNumber1 / dblNumber2
   End Select
   End If
   %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/maintemplate.dwt.asp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>GlobalSoccerEvents.com - Your Source for Soccer Events Around the Globe</title>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
td {
    font-family: Arial, Helvetica, sans-serif;
    color: #000000;
}
a {
    color: #669933;
}
-->
</style>
</head>

<body><!-- #BeginLibraryItem "/Library/mainMenu.lbi" --><table width="100%"  border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="images/logo.gif" width="257" height="58"></td>
    <td><table width=" %"  border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="home.asp">Home</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="events.asp">Events</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="mySite.asp">My Site</a></td>
  </tr>
</table>
</td>
  </tr>
</table>
<br>
<script language="JavaScript" type="text/javascript">
 var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
 sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowerCase();
 sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
 if (document.getElementById(sPageName))
 {
 document.getElementById(sPageName).style.fontweight = 'Bold';
 document.getElementById(sPageName).style.fontsize = '14pt';
 }
 </script>    
 <!-- #EndLibraryItem -->
 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><h2><!-- InstanceBeginEditable name="Title" -->Calculator<!-- InstanceEndEditable --></h2></td>
  </tr>
  <tr>
    <td><!-- InstanceBeginEditable name="Content" --><form action="calculator.asp" method="post" name="frmCalculator"><table width=" %"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="txtNumber1" type="text" value="<%=dblNumber1%>"></td>
    <td><select name="1stOperator" id="1stOperator">
      <option value="+">+</option>
      <option value="-">-</option>
      <option value="*">*</option>
      <option value="/">/</option>
    </select></td>
    <td><input name="txtNumber2" type="text" value="<%=dblNumber2%>"></td>
    <td><input name="btnCalculate" type="submit" value="Calculate"></td>
  </tr>
  <tr>
    <td colspan="4">The outcome is:<%= dblResult %> </td>
    </tr>
</table>
</form><!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td align="center"><br>
    <br>
    <br>
    <br>
    <br>
    <!-- InstanceBeginEditable name="Footer" -->Footer here<!-- InstanceEndEditable --></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>

Any help will be greatly appreciated.  dls
Reply By: Imar Reply Date: 8/18/2006 9:49:19 AM
Weird. You're supposed to get something like this:
Microsoft VBScript compilation error '800a03ea' 

Syntax error 

/calculator.asp, line 10 

Case "+"
You could try opening the site in FireFox as it shows more error detail by default. Without a detailed error page, debugging code will be pretty difficult.

Anyway, look at this:

Select Case Request Request.form("1stOperator")

This should be:

Select Case Request.Form("1stOperator")

I also noticed you're using 1stOperator with a 1 (one) and not an l (el). Right now, this is not a problem, because you also named the drop downlist 1stOperator.

However, you may run into this with other examples, so if you find you get errors, check out your 1 vs l usage...

Cheers,

P.S. Ian??

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: dennisskinner Reply Date: 8/18/2006 10:37:22 AM
Thanks Ian, I will try it.  But how did you know I was wierd.  I thought I had kept that a secret. dls
Reply By: Imar Reply Date: 8/18/2006 10:46:07 AM
Ian?? ;-)

Weird...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: dennisskinner Reply Date: 8/18/2006 10:47:00 AM
Hi again    I deleted the first "Request" in the line 10 and now everything works fine.  thanks again
Reply By: dennisskinner Reply Date: 8/18/2006 11:14:11 AM
I told you. I realized I had your name screwed up just after I sent the last one.  feel free to call me betty or brenda.  Your name and picture is on the book so sorry, my fault.  never again, i painted imar on the inside of my eyelids. dls

Reply By: Imar Reply Date: 8/18/2006 11:17:08 AM
Hahaha, no problem.

Have a good weekend and have fun with the rest of the book.

Cheers,

Ian
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Shadowplay by Joy Division (Track 9 from the album: Heart And Soul (CD 1)) What's This?

Go to topic 48395

Return to index page 200
Return to index page 199
Return to index page 198
Return to index page 197
Return to index page 196
Return to index page 195
Return to index page 194
Return to index page 193
Return to index page 192
Return to index page 191