Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JavaScript Function in Script tag revisited...



Carl -

There is a problem in accessing JavaScript functions which have been  
loaded from a <script> tag. In addition, there is a known problem where  
only the first JavaScript script loaded via a <script> tag can be  
referenced; subsequent ones are ignored.

There is a workaround for the first problem which involves using a  
global WebService object. However, it is important to note that this  
WebService object may not be available in future versions, so it is  
important to test for its existence before using it.

if (typeof WebService != "undefined")
{
	debug(WebService.Testing());
}

__________________________________________________________________
Riley Howard


On Friday, December 6, 2002, at 03:19  PM, Carl Higashionna wrote:

> Anybody been able to get a JavaScript function to work within the
> <script> tag? Below is a simple test hacked together using the sample
> project. When the user clicks the search button the String "Hello"
> should be printed in the console... the first debug statement works
> fine but the second one doesn't print anything.
>
> thanks - carl
>
>
> <triggers>
> <scripts>
> 	<script language="JavaScript">
> 	function Testing(){
> 		return "Hello";
> 	}
> 	</script>
> </scripts>
>
> <trigger path="Internet.SearchButton.action" language="JavaScript">
> 	debug("----- User clicked the search button -----");
>          debug(Testing());
> </trigger>
> </triggers>
> _______________________________________________
> sherlock-channel-development mailing list |  
> email@hidden
> Help/Unsubscribe/Archives:  
> http://www.lists.apple.com/mailman/listinfo/sherlock-channel- 
> development
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
sherlock-channel-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/sherlock-channel-development
Do not post admin requests to the list. They will be ignored.

References: 
 >JavaScript Function in Script tag revisited... (From: Carl Higashionna <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.