473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Function problems in ASP

I'm running the current function:

isbn="08307.25318"

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 2370
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(pstrValue)
Dim pstrImageURL
'Set the base path for the images.
pstrImageURL="http://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.google.c om...
I'm running the current function:

isbn="08307.25318"

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.public.inetserver.asp.general:
I'm running the current function:

isbn="08307.25318"

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.25318"

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
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...
8
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:...
4
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...
5
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) -...
39
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...
31
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...
8
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...
4
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...
28
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
53
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.