Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:14
javascript function in url (arrggg)
Poster: landolt
Dated: Wednesday September 3 2003 - 12:03:38 BST
hi
i want do a javascript function in the url-tag. but I get always the same error. i had the function in every damn js-file declare. but alway the same.
Error: todo is not defined
Zeile: 1
Code:
aI("image=images/menu/rot.gif;text=testmenu;url=javascript:todo();showmenu=Anlass;target=body;");
function todo()
{
do something.....
}
function todo()
{
do something.....
}
Poster: Maz
Dated: Wednesday September 3 2003 - 15:04:44 BST
Its a good idea to search the forum.
Either this link or search for javascript for examples.
http://www.milonic.com/forum/viewtopic.php?p=8619
maz
Poster: Hergio
Dated: Wednesday September 3 2003 - 18:37:00 BST
Define todo BEFORE you call for it in a menu item. Put your declaration for todo and the top of your menu files or put it in another .js file but include it before the menu scripts.
Poster: landolt
Dated: Thursday September 4 2003 - 8:41:31 BST
I defined the script at the top of my file. I tried also to put it in a another js.file an declare it bevor the other two.
I need a onclick-event. Why isn't there a function like onclickfunction like onfunction?
Code:
aI("text=Testmenu;onfunction=over(0);offfunction=out(0);url=javascript:clic(0);target=body;");
And here is my declaration in the head:
Code:
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function clic(no)
{
.....
}
</SCRIPT>
<SCRIPT language=JavaScript src="css/milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="css/menu_data.js" type=text/javascript></SCRIPT>
</HEAD>
<HEAD>
<SCRIPT language="JavaScript">
function clic(no)
{
.....
}
</SCRIPT>
<SCRIPT language=JavaScript src="css/milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="css/menu_data.js" type=text/javascript></SCRIPT>
</HEAD>
__at__ maz
i searched the hole forum bevor, but i didn't find my problem.
your link describes something differents.[/code]
Poster: Maz
Dated: Thursday September 4 2003 - 12:26:04 BST
Sorry, Dave knows about java, if you are trying to open the menu from a link, there was a script written in an earlier version of menu.htm page, but I don't see it anymore. Try saying exactly what you want it to do, its difficult to understand.
Regards
maz
Poster: Hergio
Dated: Thursday September 4 2003 - 13:59:40 BST
So are you saying it still doesn't work?
If so, then keep the function definition in the HEAD of your page. But move the <SCRIPT>'s for the menu to just beneath the BODY tag of the page.
Yea we have seen a possible need for an onClick event handler, rather than putting the javascript: into the url...this has caused VERY minor problems in the past (ie. stops animated Gifs on the page). Its not exactly the most pressing feature upgrade at the moment, but I think it could get implemented soon. Stay tuned.