Welcome Guest, Not a member yet? Register   Sign In
template with js cannot perfome
#1

[eluser]Unknown[/eluser]
help me please
Why my template cannot perform , this script like this in attach files

my file header
[removed]
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
about_us_over = newImage("/images/about-us-over.gif");
services_over = newImage("images/services-over.gif");
catalog_over = newImage("images/catalog-over.gif");
partners_over = newImage("../images/partners-over.gif");
contact_over = newImage("images/contact-over.gif");
preloadFlag = true;
}
}

[removed]
my template
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;?php $this->load->helper(‘html’); ?&gt;
&lt;TITLE&gt;Company Name&lt;/TITLE&gt;
&lt;?php echo “coba”;?&gt;

&lt;META HTTP-EQUIV=“Content-Type” CONTENT=“text/html; charset=windows-1250”&gt;
<!—ImageReady Preload Script (index.psd)—>

[removed][removed]
<!—End Preload Script—>
&lt;/HEAD&gt;

&lt;?php echo link_tag (“css/styles.css”);?&gt; <!—rel=“stylesheet” type=“text/css”>—>
<!—
#2

[eluser]jvicab[/eluser]
most of the time dealing with javascript could be painfull due to if the code has an error, it will fail silenty.
What I ussualy do is put an alert at the top of the javascript file to make sure it is including already in my page (alert("it works"); or something similar)
Another issue is with the path of the include file which could change based on where is located the calling script. Again, what i do is using the base_url defined to construct the path and that way it will work from any place.
Using error console in firefox would help too.




Theme © iAndrew 2016 - Forum software by © MyBB