tags:

views:

35

answers:

2

Hello, I have this problem with my .Asp file. I get an error saying 'GetFrontpageInfo' is undefined.

This is the code:

http://www.kollelbaaleibatim.com/Content_of_asp_file.txt

click "view source" to see the code.

TY

+6  A: 

You are trying to call a server side function from client side code.

The onLoad event is fired in the browser, so a client side function called GetFrontpageInfo cannot be found.

Remove the attribute and place the following at the bottom of your page:

<% GetFrontpageInfo() %>

This way, you are calling server side code from the server side.

Update:

Looking at the code again - you are also trying to call in client side in the onClick event of your input button.

An additional problem is that you are trying to call alert on the server side. This is not possible.

Perhaps you should change your function from server side (enclosed in <%%>) to client side script, and return the call to the onload event in the body tag:

<script language="vbscript>

     sub GetFrontpageInfo()

        ShortTitleLeftCar = "temp value in variable"
        messagebox(ShortTitleLeftCar)

     end sub
</script>

You seem to be mixing VBScript and Javascript, as well as client side and server side code.

Oded
I put it at the bottom of the page, right after the tag </html>, and now i'm not getting the error, but the function is not fired.
Ok. I'm starting to get what you are saying. I guess I spent way to much time doing asp.net. I'm loosing my classic asp skills. I appreciate your help.
A: 

it looks like you function GetFrontpageInfo is defined as a server-side method, but you are calling it on the client side. <body onload="GetFrontpageInfo"> is looking for a Javascript function called GetFrontpageInfo

Glennular
@Glennular - if this is IE, it _can_ also be a VBScript function.
Oded