You'll probably find that it's actually inserted the startup script prior to 
the inclusion of the myscript.js, or something like that (some type of ordering 
issue).

For all javascript related issues/debugging, I recommend the usage of FireFox 
and the FireBug plugin.  You can then inspect the generated output much 
clearer, and determine if the ordering of your script is correct.

Regards,
Matthew Cosier
Readify | Senior Developer
M: 0401 932 250 | E: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> | W: 
www.readify.net<http://www.readify.net/> | B: <http://m/> 
http://<http://cosier.wordpress.com/>cosier.wordpress.com
________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Michael Nemtsev [EMAIL 
PROTECTED]
Sent: Wednesday, 5 December 2007 10:00 AM
To: [email protected]
Cc: Neville Mehta
Subject: [OzMOSS] RegisterStartupScript doesn't see the function from external 
JS file

Dear all,

I've stumble over the strange problem that JS function can't see function from 
included .js file if it was called via RegisterStartupScript method

I have the page with "mysript.js" file included, which has a "prepareToWait()" 
function implementation.
In the codebehind class I created the another function which I wanna register 
as a startup script, and in this function I call my "prepareToWait()" from 
included file.

So, I have smth like

string initscript = "function runOnLoad() { prepareToWait(); ..<calling other 
functions>; _spBodyOnLoadFunctionNames.push('runOnLoad');"
Page.ClientScritpt.RegisterStartupScript(GetType(), "Startup", initscript, 
true);

but after calling this I have an exception on prepareToWait(); that it can't be 
found.

what could be the reason of that strange behaviour that sharepoint page can't 
see my function?
Other functions from mysript.js , which are not called via 
RegisterStartupScript,  work fine on that page

---
Michael Nemtsev

------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com - List managed by www.readify.net



------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com - List managed by www.readify.net

Reply via email to