calling a javascript client side function from ASP


G

Gabby Rozow

Hi,

I have an web application written in ASP (not ASP.NET) whose main page is
built as a frameset. On one of the framesets i have a client side javascript
function that opens a second window in my web application. I use javascript
to open the second window in a seperate window with no addressbar, toolbar,
etc...
When the user browses to the main page (for example:
www.mysite.com/main.asp) and then clicks one of several buttons, the buttons
call this javascript function with different parameters to control the
behavior of the second window. All this works very well.
However, I am now trying to add functionality to my application to enable a
user to click on a link in another website, that will send him to my web
application and open the second window automatically. I do that my adding a
querystring to the URL of the main page, so that the URL will be something
like www.mysite.com/main.asp?caller=5
Then in one of the pages in the frameset, I check the querystring for the
existance of the caller item, and if it's there, I try to call my function
by writing the following asp statement:
response.write "<script>open_second_window(" & request("caller") &
")</script>

The function performs several checks and then opens the window:
function open_second_window(param) {
//perform several lines of code building a string variable named
querystr
var second_window = window.open('secondwindow.asp'+querystr)
second_window.focus()
}

in line 3, querystr is a variable that is being built within the function.
The window.open method also gets several parameters to control the
appearance of the window as mentioned above.

when I try to link to the application from another website as described
above, I get the following error:

'null' is null or not an object
This error occurs on line 3 of the function. Everything up to that line
works well, it also all works when calling the function from one of the
buttons on one of the pages in the frameset.

I am thinking that this error happens because something has not finished
loading, but I can't figure out where to put my asp code so that this will
work.

any help would be appriciated.

Thanks,

Gabby Rozow
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top