views:

44

answers:

1

First, I created a xcode project and copied and pasted the CSS and javascript files into project folder. Second, I loaded a local .html file to UIWebView.But the css files and javascript files don't fire.

<html>
<head>
    <meta charset="UTF-8" />
    <title>test</title>
<link rel="stylesheet" type="text/css" href="css/mycss.css" ></link>
 <script src="libs/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>          
    <div id="home" class="current">
        <div class="toolbar">
            <h1>test</h1>
        </div>
        <ul id="subscriptions">

        </ul>
    </div>
</body>
</html>

can some one shine some light.

Thank

+3  A: 

You are using the wrong tag to import your CSS, and you have not imported the JavaScript at all.

Try:

<head>
   <link rel="stylesheet" type="text/css" href="css/mycss.css" ></link>
   <script type="text/javascript" src="js/myjs.js"> </script>
</head>
It Grunt
Sorry, I just edited the question. Hope it make more sense now.
jimmy
Your code is still wrong. You need to use the appropriate tag to bring in your external css file. The <style> tag is for inline CSS only. You need to use the <link> tag to bring those in.The Javascript is not firing because you are not calling any javascript functions in this HTML.
It Grunt
I changed the code as you mentioned. I still can't get the css and .js. But when I changed the path from css/mycss.css to mycss.css, it worked.So did the .js file.
jimmy
Are you going to accept this answer or are you still having other issues you'd like help with?Why did you rename the JQuery.js? Check your deployment paths and fix the script tag to bring in the JQuery library from the correct location.
It Grunt
Your answer pointed me out the syntax error. But I need to use css/mycss.css as a external link cause i don't want to put all files in the same level as index.html
jimmy
Is your question answered? If so, please check the green checkmark by my answer.
It Grunt