473,811 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple Asp Code To Print Name?

12 New Member
Hello,

Im hoping you can help, for now im trying to learn how to do something so an easy example may help me to gain the concept.

I wish to create a hyperlink that when i click it, it prints my name further down the page.

I had a search for the last few hours on the <a Href> and onclick command, but this does not make sense?.. the part im getting confused is how am i able to call a function (something like response.write "boo") and get it able to print out on the same page... could some one please write a simple .asp page using vbscript so i can see how its done, then i can try to expand on that myself.

any help will be appriciated.

if i havent explained anything correct please feel free to ask, but its only a simple example i want... just so when i click a hyperlink, it prints some text out on the same page.

The reason i want this, is once i get the concept, i will have a list of the alphabet and on each one will have a sql statement that will return some values....

Im using .ASP, VBScript. thanks!
Dec 6 '07 #1
7 2206
Kandiman
12 New Member
Okay i realised how to do it, but not in the most stylish way....

<SCRIPT LANGUAGE="VBScr ipt">
<!--
Sub MyFunctionA()
Dim Letter
Letter = "You selected A"
txtResult.Value = Letter
End Sub
-->
</SCRIPT>

goes at the top, and my code is

<A href="#" onClick="MyFunc tionA()">a<a>


and is displayed:

<Table>
<tr>
<td>Name:</td>
<td><input type="text" name="txtResult "size="40"> </td>
</tr>
</Table>


now just need to know how to pass something back via a variable so i can use response.write? ... any ideas?
Dec 6 '07 #2
Nicodemas
164 Recognized Expert New Member
You could do somethign like this with JavaScript easily, but if you want ASP to do it, you could:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim myName
  3. myName = request.querystring("n")
  4. %>
  5.  
  6. <a href="?n=A">A</a>
  7.  
  8. <%
  9. if myName <> "" then
  10.    response.write "I clicked: "& myName
  11. end if
  12. %>
  13.  
Does this answer your question?
Dec 6 '07 #3
Kandiman
12 New Member
i since hanged my code, to use javascript and post data,... but now in trying to read post data from my hyperlink...


<SCRIPT LANGUAGE="JavaS cript">
<!--
function AddWithForm()
{
//Variables will be retrieved from submitted form
document.Shows. submit();
return true;
}
-->
</SCRIPT>

-------------------------------------------------------

<FORM id="Shows" name="Shows" method="post" action="Shows.a sp">
---------------------------------------------------------
<%
'VB Scipt in here (server side)
dim Vletter
dim letter

letter = Request.Form("N umber1")
Vletter = "The letter you have clicked on is: " & letter
%>

-------------------------------------------------------

<A href="#" id=Number1 name=Number1 value="a" onClick="AddWit hForm()">a<a>

---------------------------------------------------------------

<% Response.Write Vletter %>




but this is not printing out the value thats been passed "a" just the text "The letter you have clicked on is: "....

any idea on how to solve this?....
Dec 7 '07 #4
deric
92 New Member
Maybe you didn't click the "a" link.. the form has to be submitted first before it can get the value of "Number1". On first load of the page, it doesn't have any form to request.
Dec 8 '07 #5
Nicodemas
164 Recognized Expert New Member
Did you try my code above? It should work just fine.
Dec 11 '07 #6
chaitanya1167
8 New Member
IN ASP

Place a LinkButton
on doubleclick
Response.Write( "Name");
Dec 11 '07 #7
Nicodemas
164 Recognized Expert New Member
Unless I completely misunderstood the original request, I have posted a viable solution to the user's problem. He isn't using .NET, as stated in the last sentence of the original topic.
Dec 13 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5306
by: Cergon | last post by:
hi, i hope someone can help. Im pretty new to this php stuff and i have a slight problem. I have this script (shown below) which writes data to a text file which is then displayed on my front page. Trouble is after moving to an apache server with php on a windows platform the script no longer works. It worked fine on the unix platform. All it does now is just wipes the text file and does not write anyhing else to it, any help would be...
10
1903
by: george young | last post by:
For each run of my app, I have a known set of (<100) wafer names. Names are sometimes simply integers, sometimes a short string, and sometimes a short string followed by an integer, e.g.: 5, 6, 7, 8, 9, bar, foo_6, foo_7, foo_8, foo_9, foo_10, foo_11 I need to read user input of a subset of these. The user will type a set of names separated by commas (with optional white space), but there may also be sequences indicated by a dash...
7
1525
by: mx2k | last post by:
Hello @ all, we have written a small program (code below) for our own in-developement rpg system, which is getting values for 4 RPG-Characters and doing some calculations with it. now we're trying hard to find out how to get it working with 'n' Characters, so you will be asked to enter a number at the beginning, asking you how many characters you want.
27
2401
by: Brian Sabbey | last post by:
Here is a first draft of a PEP for thunks. Please let me know what you think. If there is a positive response, I will create a real PEP. I made a patch that implements thunks as described here. It is available at: http://staff.washington.edu/sabbey/py_do Good background on thunks can be found in ref. . Simple Thunks
3
2044
by: Dara Durum | last post by:
Hi ! Py2.4, Win32. I need to optimize a program that have a speciality: hash (MD5/SHA1) the file contents (many files). Now I do this in a simple python program, because (what a pity) the FSUM utility died in a file with unicode filename... (It is unknown error: I used alternate file name, but it not found).
0
1422
by: JohnLucas | last post by:
Hi all, I have just started working with the XML::Simple module to parse an XML file. I'm trying to pull some values from the file that I need in another program. The problem is that the XML file is "nested" and I can't get the correct values out of the file. This is part of my xml file: <?xml version="1.0" encoding="ISO-8859-1"?> <Root>
6
2446
by: SuperFool | last post by:
This has got to be one of those questions only a serious newbie would come up with.... Basicly: I select all the city names in the table and turn them into a pull down menu (code below) print "<form action=\"update-city.php\" method=\"post\" name=\"theform\">"; print "<SELECT id=\"city\">\n"; while ($row =mysql_fetch_object($result)) { foreach ($row as $col=>$val){
5
2309
by: simononestop | last post by:
Hi im totally new to perl this is my first go at using it (I normally use asp). I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an email. however all the information is missing form the email I only get the first form text field?? #!/bin/perl # ------------------------------------------------------------
8
1839
by: autodidact | last post by:
I wrote a simple code to look up peoples numbers. But what if the user types in a name that is not on the list, how may i get my code to alert the user try again till a correct name is entered? I'm trying to kill two birds with one stone. So how would you guys rate my code in terms of efficiency. And any additional comments would be appreciated. Thanks In Advance! My code also be viewed here
7
242
by: bvdp | last post by:
I'm finding my quest for a safe eval() quite frustrating :) Any comments on this: Just forget about getting python to do this and, instead, grab my set of values (from a user supplied text file) and call an external program like 'bc' to do the dirty work. I think that this would avoid someone from embedding os.system("rm ...") in what I thought would be a math expression and having it maybe do damage? Perhaps I'm getting too paranoid in...
0
9727
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10133
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6889
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.