...

View Full Version : calling function from external js fails



docock
08-19-2011, 03:57 AM
On my site I'm using an external (big) javascript file, in this external file there is a function with the following line in it:



function showslide(){
return(currentSlide);
}

In my main html file the external javascript file is loaded within the head section. This external file does a lot of other stuff besides returning a number.

Now here is my problem..
Somewhere in my html file I need to call the showslide function. I tried doing that with this:


<script language ="Javascript" src="upload/3weg_slider.js">
document.write(showslide());
</script>

But it doesn't return anything, when I place an alert line within the function it doesn't show up either. What am I doing wrong here?

DaveyErwin
08-19-2011, 04:41 AM
change ....


<script language ="Javascript" src="upload/3weg_slider.js">
document.write(showslide());
</script>to this ....


<script language ="Javascript" src="upload/3weg_slider.js">
document.write(showslide());
</script>

<script language ="Javascript" >
document.write(showslide());
</script>

then come back and ask more questions
:)

docock
08-19-2011, 10:23 AM
I've tried that, but it still doesn't give me any result :S



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum