|
-
Nov 22nd, 2000, 09:27 AM
#1
Thread Starter
Addicted Member
Hi,
I have a ( borrowed ) javascript program ftiens4.js which contains a number of Javascript functions. I want to be able to call a function (clickonnode) inside this javascript file from my image in an HTML file, can someone let me know the syntax. I presume it is associated with the onclick event on my image but need the specifics of the filename.functionName for the JS file.
I have the following
<td><img SRC="../regions/maps/map%20uk.jpg" USEMAP="#mapuk" BORDER="0" align="middle" WIDTH="397" HEIGHT="382" onclick="ftiens4.js????????>
as usual
thanks in advance.
Lenin.
-
Nov 22nd, 2000, 09:30 AM
#2
Thread Starter
Addicted Member
If this is a simple include scenario, ignore me.
Lenin
-
Nov 22nd, 2000, 10:53 AM
#3
Frenzied Member
stick this in the <head> section of your page and then just call the function in the usual way.
Code:
<SCRIPT LANGUAGE = 'JavaScript'
SRC="./ftiens4.js">
</SCRIPT>
-
Nov 22nd, 2000, 11:16 AM
#4
Thread Starter
Addicted Member
Thanks ( again ) Mark. I seem to get an "Object Required" error ( file not located ? in the same directory though so would expect ./XXX to work) when I execute the script from a button click.
I also found a reference in MSDN requiring a registry setting to be changed in
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Inetinfo\parameters\MimeMap
do you know if this is relevant?
The function is the .js file is
function clickOnNode(folderId)
{
var clickedFolder = 0
var state = 0
clickedFolder = indexOfEntries[folderId]
state = clickedFolder.isOpen
clickedFolder.setState(!state) //open<->close
}
<head><SCRIPT LANGUAGE = 'JavaScript' SRC="./ftiens4.js"></SCRIPT></head>
<button class="Button" tabIndex="21" onclick="SetTreeNode();">TTT</button>
<script LANGUAGE="JavaScript">
<!--
function SetTreeNode()
{
clickOnNode(9);
}
thanks
Lenin
-
Nov 22nd, 2000, 11:24 AM
#5
Frenzied Member
you certainly shouldn't have to change the registry!!!
you've got some wierd HTML there though.
for a button I always use <input type=button etc..>
go back to where you pinched the js file from and have a look at the file in which it is used. You might need a style sheet as well (or somthing like that)
-
Nov 22nd, 2000, 12:04 PM
#6
Thread Starter
Addicted Member
sorry Mark no luck ( i.e no stylesheets ). I think I will put this aside and revisit, a bit out of my abilities. As usual I didn't mention something which may be critical, that is that the js file is executed in a frameset and my page is in another from, so I would need to call parent.document.scriptName I think.
Thanks for the pointers, as usual very helpful.
Lenin.
-
Nov 22nd, 2000, 01:18 PM
#7
The path on the SRC to your .js file looks wierd. You have:
./ftiens4.js
If the .js is in the same folder as your project you could just use:
ftiens4.js
If it's in your servers virtual root you could use:
/ftiens4.js
Why the '.' before the '/'?
Paul
-
Nov 23rd, 2000, 03:59 AM
#8
Thread Starter
Addicted Member
Think it means current directory.
-
Nov 23rd, 2000, 05:00 AM
#9
Member
Have the .js file in the same directory as your html file and put the follwing between your HEAD tags:
Code:
<script language="javascript" src="ftiens4.js"></script>
Now within your BODY tags try this:
Code:
<a href="javascript: clickonnode();">
<img src="pic.jpg" border="0">
</a>
[Edited by N*G*Evangelion on 11-23-2000 at 08:37 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|