Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    ASP




Simple Percentage Scrip


I need to build a script where in the source code i enter a number and when the page is executed it shows a percentage.

Here is an example of what i'm trying to do

88.83 / 12 = 740%

and the 740% is the only visable thing on the page




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Calling CGI Scrip
I'm still learning ASP and was wondering if there was any way to pass data to a CGI script on another server, retrieve and then possibly format the data within ASP? I've seen a 3rd party component called ASPHTTP, but was wondering if there were any other methods.

Getting Percentage
I wrote a survey script but I had problem with the percentage.If 5 persons answers to a question YES and 3 answered NO, how can I get the percentage of each answer (YES & NO)?

Get Correct Percentage
I've always been looking for the best way to get an accurate percentage
statistics.

For example, in a election scenario:

Person A gets 33 votes
Person B gets 33 votes
Person C gets 34 votes
Person D gets 35 votes

Total votes = 33 + 33 + 34 + 35 = 135
Percent for A = 0.244.... = 0.24 = 24%
Percent for B = 0.244... = 0.24 = 24%
Percent for C = 0.251... = 0.25 = 25%
Percent for D = 0.259... = 0.26 = 26%

Then add up the percentage values: 24 + 24 + 25 + 26 = 99
(where it should be 100)

So, does anybody have a way to get around this problem? How should I
calculate the percentage for each person so that the percentage will add up
to 100 in the end?

Calculate Percentage
Our store software currently displays the total amount saved (the list price minus our price) for every product using the code below:

'Calculate "YouSave"
If Product_ListPrice > 0 Then
Product_YouSave = Product_ListPrice - Product_LowestPrice
End If

I, however, would like to also diplay the percentage saved next to the amount saved. I tried using the code below but it won't work. Can someone help me out?

'Calculate "YouSavePercent"
If Product_ListPrice > 0 Then
Product_YouSavePercent = ((1 - (Product_LowestPrice / Product_ListPrice) * 100)
End If

Percentage Calculation Formula
I have to calculate the percentage of an X amount depending on the Quarter of the year. It's driving me crazy, I can't figure out how to do it. Am I missing something. If someone registers the 1st quarter then the price is the full 1200. f the registration occurs the 2nd Quarter, then it is 25% less that rthe full amount. The 3rd is 50% less and the 4th is 75% less.

the amount is 1200
the Quarters of the year = 4
The regristrant is 1

(1200/4)*100 ?????

Calculate A Percentage For Pricing
Well my goal is simple. On my site we show "You save: $**.**" but I want that to say "You save: $**.** (**%)."

The database for our store stores the list price, and our price. The store calculates the you save price... so it should be easy to calculate the saved percentage as well. Here's the code that calculates up the "You save" currently on our website: Code:

Percentage On Search Result
i'm sure there're no post about this in asp forum.Any idea how do I show the percentage number for the matching result.

example :

Your search for xxxx :

1. item 1 98%
2. item 2 86%
3. item 3 75%

Converting Number To Percentage Function
I want to convert a number to percentage, is there any built-in function for this?

Simple One
i have 3 fields like these
membershipamount=100.00
Postage=15.00
GiftArticles_Amount=5.00

and i add them up to get the totalcharge like this

Total_charge=Int(membershipamount) + int(Postage) + int(GiftArticles_Amount)

so i get Total_charge=120.00 which is what i want

but when i have like this

membershipamount=100.00
Postage=15.00
GiftArticles_Amount=3.50

i get Total_charge=118.00

Simple One
does someone know a good site for asp 3.0 interiew questions

Simple If
I have only begun to look into ASP due to an assignments requirements.I usually code in PHP,one feature in PHP is to be able to do an if.else statement,where if a certain statement is true then a chunk of HTML can be outputted.

Basically I want to be able to do this in ASP to use with a simple authentication system which I will construct.I have just got a fat book on ASP,and am beginning to read through it


Simple If/else
I am not an ASP programmer, but I need help with the syntax. I have a simple if/else statement that I need to translate into ASP. Begin Pseudocode

if
{
(id == 1,2,3,4,5,6),
then print "Private"
}
else
{
Print <a href="https://www.mydomain.com/file.asp?ID=<%=rs("ID")%>" target="_blank">Register</a>
}
End Pseudocode

So how do I say this in ASP?

Simple Upload
i'm trying to create just a simple upload - fill in a form with the article
title, and description - and select a file - i need to upload that file to
the webserver, and then rename that file to the <% =Sartid %>.pdf

any ideas where to get something this simple from? never done anything like
this before - i'm guessing the FSO will be used?

Simple Sendmail With CDO
This code is working partially fine

<%
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserver") = "mail.aws.no"
cdoConfig.fields.update

Set cdoMessage = Server.CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = Request.Form("E-Mail")
cdoMessage.To = Request.Form("sendto")
cdoMessage.Subject = "Tilbakemelding fra nettsiden"
cdoMessage.TextBody = strBody
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.redirect Request.form("resulturl")
%>

Well, this works with only some addresses and not others.

Examples:

bjorn@domain.no
b@2.com

will work...

On the other hand:

bjorn.kaa@domain.no
bjorn-kaa@domain.no

won't work at all...

Simple ASP Page
I need to send data from a 'form' on an HTML page to an ASP page.

The ASP page should 'return' a simple HTML page containing
the data from any items submitted, including any hidden items.

Simple Login
A user logs in, then based on their account (username/pass), they are redirected to a specific web address.
I only need 3 different accounts.
Can this be done with Javascript? Or do I need to use a database?
If you can point me to some script that will achieve this I would love it!

Simple Problem
I got a small problem that I think you can solve in a sec.I use ASP to tell day, date, month etc on this page:
http://www.aljapaco.com/award/nyawar...rd&val=purpose

But,as the servers is in Sweden and I´m in Sweden to, I see the text in Swedish.
Can anyone that lives in any other country just please tell me if the text is in English when youre not viewing it from a Swedish connection.
IF it´s still in Swedish, how (if) can I make it change to English text or am I stuck with some messy old Java Script??

ASP Simple Upload
does anyone know of a good place to find code samples for ASP Simple Upload. I can't seem to get to the original site.

What I need to do is upload the file and save the path and some other info into to a database.

Simple IF Statement
I have a stylesheet switcher which store the user style preference in a cookie, however how do I modify the following to use the default stylesheet of “styles.css” if there is no cookie on the users computer? Code:

Simple Update Where?
Ok how do i update based on 2 Where options
i know this is wrong but i don't know how to do it.

strSQL = "UPDATE [Job Contract Assignments] SET currentassignment = 0 WHERE cnum= '" & cnumqs & "' "&" WHERE currentassignment = -1"
SQLconnect.Execute(strSQL)

Simple Thing
can someone tell me whats wrong with this code.i applying the style in right way

Code:

<tr style="background-color: #386cae; color: #000000; a:link {color: #000000; font-weight: bold;}
a:visited {color: #ded9dd;} a:hover {color: #000000; font-weight: bold; decoration: underline;}">

Simple Textbox
i have a shopping cart type system where a user adds items to their cart, and as they are doing this, i have a textbox for the user to enter the quantity of the selected item they want!i want this textbox to be max. 3 characters in length (for asthetic purposes!!) but no matter waht width i make it, it is always displayed much bigger(longer) than i want! So how do i force this
textbox to be no more than 3 characters in length?

Simple Query
I want to display a message if the submit button was pushed on the same page.

<% If Request.form("submit") = "Submit" Then

Response.Write "Your photo was successfully uploaded."

END IF %>

The action of the form is the same page. Code:

Simple Task
I want is to have my asp code test if it is the first time the page has loaded. If so it will need to skip my validation info, if not then run the validation code:

Simple Checkbox To / From DB
I have a form that only has one check box in it for active / inactive. This form is when viewing a member record. My 2 questions are:

How do I get the checkbox into the form showing the state that it is in the database? - I can get a check box to show, but can not get it to show ticked / not ticked according to the database Code:

Simple DB Permissions
I have a database (*.mdb), which I can connect to, query on, and return results from in ASP. Now, I want to do some ADDs,UPDATEs,and DELETEs.... but I get errors executing my SQL... What's the trick?

PS My connection (thus far) is this, and works.

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider="Microsoft.Jet.OLEDB.4.0"
Conn.Open Server.MapPath("myDatabase.mdb")

Simple Cookie
I have this little flash movie on the main page of a website and I want to set the cookie so that when user first enters the site, the flash plays but when the user browses around and goes back to the main page, the flash movie won't repeat again ... kinda like ........ they can only see the movie 1 time when first entering the site but after that they won't be able to see it again unless they clear their cookies from their computer

Simple ASP Uploader .dll
how can get simpleaspuploader for free.

Simple Math
I am trying to add my numeric fields together to produce a total. Does the following make sense to anyone? Code:

Word To Simple XML
I'm currently creating a site that involves people with very little computational skills, proficient only really in word processing, submiting various technical documents to be uploaded to the website.

Because of the generally well-structured outline of these technical documents, I am going to store them in either a relational database (such as MySQL), or in XML form, or both. However, the problem is that most of these documents all ready exist in MS Word (.doc) format, and the documents to come in the future will also be created using Word by the aforementioned people.

I am going to make a simple, online content management system using either PHP or VB.NET (dosen't really matter to me), and I want these people to be able to upload a Word document, and have my CMS script automatically convert the .doc (or rtf rich-text, whatever's easier) into a simple, straightforward xml, similar to DocBook or something (not like Word 2003's incredibly complicated xml). Does anyone have any recommendations on how to go about doing this?

Simple Equation
I need to know the equation to pull back the sheet name of the sheet i am working on in excel ....

Simple Loop
I'm trying to make a loop but can't get it right.I'm trying to loop through a HTML table with one row and five columns and search for a specific value, but since tablecells are not objects I don't understand how to do it.


Simple Menu
I want to create a simple menu with four buttons that when each one is individually clickec it sends you to a relevant page/submenu.

Simple WHERE Statement
Here is the WHERE statement that I am using (or trying to use)Code:

strSQL = "SELECT * FROM articles WHERE archives=1"

so if it has a 1 in the archive field it is to display the record.

Simple Log In Error
is it possible to write some javascript within my ASP page, which will determine:

1. are either the username or password text box empty
2. is the username syntactically invalid
3. is the password syntactically invalid

The idea is that when a user clicks on the Log In 'submit' button, the javascript will detect if any of the above conditions are true, and if so, will raise a window error box informing the user of the error. If none of the conditions are true, then the info will simply be sent to the next page which determines if the username - password combination match with one in my DB.

if this is possible, how would i go about enforcing the script to be run, when the user clicks on the 'Log In' button.

Simple Script
cat is category and price is a price as always.

mySQL="SELECT cat,price,name FROM packs ORDER BY cat, price ASC"

i am printing name and price. in first order: by category and second(inside each category) order by price. i print each item without the category name. what is the right way to print the category before printing each category records(from the same category that i wonna print).

Simple Format
Ever think of whats the different between <% =variable %> and <% response.write("variable") %>? . is there any performance or standard issue here?

Simple Array
if I have a dynamic array dimmed as an array called

THEOtherWords()
then I have a dynamic string called str that might look like this "this is a good day"
or anything (dynamic remember!). How do I fill the array THEOtherWords() with all of str's contents using the spaces in the string ("") as the delimitter.

I cannot use a split because the var is already declared as an array if it were declared as a string, no problem TheOtherWords = Split(Cstr(str), " "). because its previously declared as an array is really messing me up.

Simple String
I am trying to add text on to a string but the string is getting erased whenever I try to add text to it. I am using code like this:

String=String&"Text"
It just makes the string="Text"

How do I just add to it? I am aware this is a simple problem but I have never used asp for strings like this.

2 Simple Queries Into One
the following statement doesn't work, even thoug when I execute SQL_1 and SQL_2 separetlly it works fine.


SQL_1 = "SELECT COUNT(*) AS ACTIVE_LINKS FROM TABLE_LINK WHERE ACTIVE = 1"
SQL_2 = "SELECT COUNT(*) AS UN_LINKS FROM TABLE_LINK WHERE ACTIVE = 0"
SQL = SQL_1 & " UNION " & SQL_2 ...

Simple Request
I have a simple entry form that is used for the basis of a courier request system. To simplify things, what I need is for one of the Request entry fields to only be available if a previous dropdown <select> entry meets a certain criteria - ie field2 is only seen/usable if field1 = "sameday" .

Simple StrLen Question
I have an asp page that connects to a database table. One of the fields is of type memo. One the page I want to display the length of that field in characters. I tried this -

<%= strLen(rs("description")) %> but that does not seem to work. Does strLen work with memo fields?

Simple Question About Includes
I have a menu I want to include on every page but may update at a later stage so it's easier to use an include. The menu is just a basic html table, no vbscript contained within it. The site is a mixture of static page and ASPs, should I use #include file ="menu.htm" or #include file="menu.asp"?

Also if I have a .htm page, can it have an #include file="menu.htm" or must I give that page a .asp extension?

Simple File Sharing Is Not Enough
to share files is 1 thing as IIs will od it just fine on its own, however i would like to give my site a little more than white backgrounds and garbage about times files are created so i ( with some help ) wrote the following script. Code:

Simple 'Random' Question
What is the best way to select a random record from a DB? I know I could do a simple Int() and Rnd combo, but is this the best way?

Simple Mssql Functions
what are some simple fuctions, like how do i get the date using mssql. also wheres a good tutorial on mssql

Cannot Do Simple Request.QueryString On IIS 6.0
I've encountered many problems upgrading my Win2K Server to Windows 2003
Server, not the least of which involve IIS 6.0 and ASP (classic) support.

For example...
I'm getting Event ID 2236: The server failed to load application
'/LM/W3SVC/87257621/Root'. The error was 'Could not read key from registry'.
Application Log entries whenever certain ASP code is executed. These are
ASP pages that ran fine for years under Win2K/IIS 5.0.

I can do Response.Write without a problem, but something as simple as
Request.QueryString("IsActive") yields the above event and a nasty error
'8002801d'.

Has anybody encountered this kind of difficulty with ASP on IIS 6.0? Does
anybody have a clue as to how to correct this behavior?

Simple GridView Question
I have a GridView with bound columns and one of them is a STATUS column from my DB table. The values in that table are single characters like A, C, and P (like Active, Complete, and Pending). How can I display the description based on the single character? I'm using Access so I can't use a case statment in the query.

A Simple ASP Email Form?
Ive searched the net, and ive had difficulty trying to get CDONT to work, nor "Server.CreateObject("SMTPsvg.Mailer")". I have my own server, and am using Windows set up. Perhaps theres a different type of script out there, and reasonably simple to run?


Copyright © 2005-08 www.BigResource.com, All rights reserved