Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 27
Registered: ‎01-20-2011
My Device: Bold
My Carrier: Developer

[help] javascript not loaded

i'm a newbie in blackberry just trying a simple html which is load function from another js file

 

this is the file

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
<title>Insert title here</title>
<script src="http://localhost/testing/js/test.js" type="text/javascript"></script>
</head>
<body onload="loadCategory();">
<p>Hello World</p>   
</select>
</body>
</html>

 

 

and the test.js, only an simple alert function

 

function loadCategory() {
    alert("testing");
}

 

 

when i start the appllication the alert is not show up

but if i put the function in the index.html the alert is shown up

 

could anybody help me

 

Best Regard

 

William

 

 

---------------------------------------------------------------
Best Regards

William
Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: [help] javascript not loaded

[ Edited ]

Don't use localhost except you have already web server running in your local PC.

Just try to put the test.js in the same path as index.html, then:

 

<script src="test.js" type="text/javascript"></script>

 

 

Contributor
Posts: 27
Registered: ‎01-20-2011
My Device: Bold
My Carrier: Developer

Re: [help] javascript not loaded

hi agungeddy, thx for the answer its run successfull, but i'm still wondering why i cannot include an javascript in other domain (i already set the permission for the domain)
---------------------------------------------------------------
Best Regards

William
Developer
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: [help] javascript not loaded

Some possibilities, like:

 

1. Still error method in your config.xml, or

2. The web server that contains js file is not working properly, or

3. etc.. etc...