Javascript !!

#1
[eluser]Shaileen[/eluser]
Hi guys,

can you please tell me how can i implement javascript in my view?

below is the self defined function to check users information in javascript that i want to implement in CI...


if (document.forms[0].eu_address.value.length ==0){
alert('Please enter the End User Address.')
return false}
if (document.forms[0].eu_city.value.length ==0){
alert('Please enter the End User City.')
return false}

#2
[eluser]ciGR[/eluser]
You can implement the js code in your view into

Code:
<scipt type='text/javascript'></scipt>
tags
Or you can write your code into a seperate js file, like mycode.js and create for example the below file stracture:

Code:
|-- assets
    |-- js
        |--mycode.js
|-- system
|-- index.php

and call it in your view with
Code:
<scipt type = 'text/javascript' src = '&lt;?php echo base_url(); ?&gt;/assets/js/mycode.js'></scipt>


P.S. I write above scipt instead script because for security reasons, forum remove the script tags.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.