Welcome Guest, Not a member yet? Register   Sign In
where to put javascript
#11

[eluser]henrihnr[/eluser]
[quote author="Bramme" date="1225493203"]I can't believe how many people have problems understanding this. This must've come up a 1000 times allready.[/quote]

cause CI have million newcomers...Tongue
#12

[eluser]syntaxerror[/eluser]
Quote:Please do as inparo promoteā€¦

and invoke your script using url helper

src="<?php echo base_url(); ?>js/mootools.js"

no luck....Sad
#13

[eluser]syntaxerror[/eluser]
i got it!
i copy/paste the javascript directory after the base url.
Code:
C:\xampp\htdocs\DSValidator\javascript
and change my script to
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;link rel="stylesheet" href="&lt;?php echo base_url(); ?&gt;javascript/demo.css" type="text/css" /&gt;
    [removed][removed]
    [removed][removed]
    &lt;title&gt;MouseEnter Demo&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    <div id="myElement">
    </div>
    
    <div id="myOtherElement">
        <span><strong>Menu</strong></span>
        <div>
            <a href="#">Client 1</a>
            <a href="#">Client 2</a>
            <a href="#">Client 3</a>
        </div>
    </div>
&lt;/body&gt;
&lt;/html&gt;

maybe this will help to anyone who have the same issue.
im sorry but i didnt made the [remove][/remove] tag.
its in the forum

thanks for all the help guys.
#14

[eluser]henrihnr[/eluser]
Nah you got it... Big Grin
#15

[eluser]alex-and-r[/eluser]
So I believe your javascript call is under [remove][/remove] tag? The forum engine cut it out?

I have the same problem. I'm trying to link to the script (this one: http://www.numberoverflow.com/scripts/ja...placement/) and it seems that js isn't loading and i can't figure out why...

Is it possible to describe your directory tree and where javascript is located and how do you link to it?
#16

[eluser]Pascal Kriete[/eluser]
alex-and-r, base_url() gives you the path that you set in your config file. Then just add the rest of the path to the javascript file.

Here's an example:
[pre]
public_html
- ci
-- index.php
-- application
-- javascript (js files go in here!)
-- system
[/pre]
In this case base_url would give me example.com/ci (assuming I've set it correctly). So then I add javascript/filename.js.
Code:
&lt;script src="&lt;?= base_url(); ?&gt;javascript/filename.js"&gt;&lt;/script&gt;

The easiest way to work out problems with this is to view the source of the rendered page, to see where it's going wrong.
#17

[eluser]syntaxerror[/eluser]
make a directory of your js files in the root folder where system directory resides
and i use this
Code:
src="&lt;?php echo base_url(); ?&gt;your js directory/mootools.js

hope it will help you




Theme © iAndrew 2016 - Forum software by © MyBB