473,543 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function problems in ASP

I'm running the current function:

isbn="08307.253 18"

function geturl(value)
image="http://www.gospellight .com/Merchant2/graphics/00000001/"
image=image & value & ".jpg"
response.write image
end function

geturl(isbn)

If I run this in an html page, it works fine, as in <% geturl(isbn) %>
and that is inserted into the html, it works.

However, if this is inserted into a line of asp code, it blows up on
me, prorobly because of the response.write inside of the function. If
I take out the response.write, it dosn't return any value at all. How
do I get it to return a value if I'm not using the response.write
object/method?
Jul 19 '05 #1
2 2374
function geturl(value)
image="http://www.gospellight .com/Merchant2/graphics/00000001/"
image=image & value & ".jpg"
geturl = image
end function

Or a slightly better coded version (with variable type suggestions):

'Function to return a modified image URL from the image name part and a
standard base path and extension.
Function GetURL(pstrValu e)
Dim pstrImageURL
'Set the base path for the images.
pstrImageURL="h ttp://www.gospellight .com/Merchant2/graphics/00000001/"
'Add the specific image name and extension.
pstrImageURL = pstrImageURL & pstrValue & ".jpg"
'Return the newly concatenated value.
GetURL = pstrImageURL
End Function

I suspect that you don't have 'Option Explicit' at the top of your ASP page
and are relying on implicit variable creation? That's pretty dangerous - you
should always have Option Explicit set and declare your variables to aid in
debugging.

Chris.

"Frank" <wi************ @yahoo.com> wrote in message
news:73******** *************** ***@posting.goo gle.com...
I'm running the current function:

isbn="08307.253 18"

function geturl(value)
image="http://www.gospellight .com/Merchant2/graphics/00000001/"
image=image & value & ".jpg"
response.write image
end function

geturl(isbn)

If I run this in an html page, it works fine, as in <% geturl(isbn) %>
and that is inserted into the html, it works.

However, if this is inserted into a line of asp code, it blows up on
me, prorobly because of the response.write inside of the function. If
I take out the response.write, it dosn't return any value at all. How
do I get it to return a value if I'm not using the response.write
object/method?
Jul 19 '05 #2
Frank wrote on 07 aug 2003 in microsoft.publi c.inetserver.as p.general:
I'm running the current function:

isbn="08307.253 18"

function geturl(value)
image="http://www.gospellight .com/Merchant2/graphics/00000001/"
image=image & value & ".jpg"
response.write image
end function

geturl(isbn)

If I run this in an html page, it works fine, as in <% geturl(isbn) %>
and that is inserted into the html, it works.

However, if this is inserted into a line of asp code, it blows up on
me, prorobly because of the response.write inside of the function. If
I take out the response.write, it dosn't return any value at all. How
do I get it to return a value if I'm not using the response.write
object/method?


<%
isbn="08307.253 18"

function geturl(value)
image="http://www.gospellight .com/Merchant2/graphics/00000001/"
image=image & value & ".jpg"
geturl = image
end function
%>

And then do:

<img src="<% = geturl(isbn) %>">
Or

Response.write "<img src='" & geturl(isbn) & "'>"
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4938
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
8
2093
by: Ares Lagae | last post by:
When adopting the coding style of the standard C++ library, you often run into naming problems because class names are lower case, and member functions do not have get/set prefixes. For example: - The class stringstream has a member function "string stringstream::str()". It would be more logical to name it "string stringstream::string()"....
4
6059
by: Vitali Gontsharuk | last post by:
Hallo! When using the XPATH document() function to load a new XML document, we are coming across problems, because XALAN seems to have problems with absolute paths. XALAN always assumes that the path is relative to the current directory. So if we e.g. are in "c:\xslt_scripts" and are trying to load an XML file from "c:\xml_files\test.xml"...
5
8782
by: Corky | last post by:
This works: db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID = PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) - DAYS(PROBLEMS.CLOSE_DATE)) = 365 AND PROBLEMS.CLOSE_DATE IS NOT NULL But this doesn't: db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM...
39
2192
by: zeus | last post by:
I know function overloading is not supported in C. I have a few questions about this: 1. Why? is it from technical reasons? if so, which? 2. why wasn't it introduced to the ANSI? 3. Is there any C implementation supporting this feature? I assume some of you will claim that there is no need in function overloading, so I would like to know...
31
3682
by: bilbothebagginsbab5 AT freenet DOT de | last post by:
Hello, hello. So. I've read what I could find on google(groups) for this, also the faq of comp.lang.c. But still I do not understand why there is not standard method to "(...) query the malloc package to find out how big an allocated block is". ( Question 7.27) Is there somwhere explained why - because it would seem to me, that free()
8
2666
by: ais523 | last post by:
I use this function that I wrote for inputting strings. It's meant to return a pointer to mallocated memory holding one input string, or 0 on error. (Personally, I prefer to use 0 to NULL when returning null pointers.) It looks pretty watertight to me, but my version of lint complains about use of deallocated pointers, etc. Is this code...
4
3780
by: Kelii | last post by:
Hi all, (WinXP Pro SP2, Access 2003) I'm using Dev Ashish's fRefreshLinks function from AccessWeb (http://www.mvps.org/access/tables/tbl0009.htm) to relink tables in my front end to one of several back end files. When I first dropped in the function I was getting an error on one of my tables saying "Couldn't relink table, table doesn't...
28
3774
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
53
8322
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script language="javascript" type="text/javascript">
0
7594
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. ...
0
7697
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...
0
5889
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...
1
5285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4899
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...
0
3394
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1830
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
648
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.