trying to add this to a menu link how is it done?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
douza
Beginner
Beginner
Posts: 3
Joined: Sat Oct 18, 2003 6:19 pm

trying to add this to a menu link how is it done?

Post by douza »

trying to add this to a menu link how is it done?

<a HREF onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.mydomain.co.uk');">Set Homepage</a>
any help will be great

Marshy
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Try this....

In menu_data...

Code: Select all

function doSomething( vThis )
{
   vThis.style.behavior="url(#default#homepage)";
   vThis.setHomePage("http://www.mydomain.co.uk");
}

///new menu item(){ blah blah...
...
...
aI("text=Set Homepage;url=doSomething(this);");
...}
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
douza
Beginner
Beginner
Posts: 3
Joined: Sat Oct 18, 2003 6:19 pm

Post by douza »

dosn't work just get error msg below

Image

Line:43
Error: 'style' is null or not an object

Any more help?

thanks

Marshy
douza
Beginner
Beginner
Posts: 3
Joined: Sat Oct 18, 2003 6:19 pm

Post by douza »

Anybody know how to add this link to the menu,,,,Hergio
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

If and when somebody has an answer for you it will be posted. Adding another topic and copying all the messages simply wastes everybody's time and will not make things happen any faster. That's why it has been deleted.
John
rhodos
Beginner
Beginner
Posts: 9
Joined: Wed Nov 05, 2003 7:32 am

Post by rhodos »

Hey douza,
have you got a solution for this problem yet? would be very nice for me too...
Ciao
Thomas
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Boy am I stupid, there are two things you can do...one if fix my last but of code I sent, I believe it was wrong. Should be...

Code: Select all

function doSomething( vThis ) 
{ 
   vThis.style.behavior="url(#default#homepage)"; 
   vThis.setHomePage("http://www.mydomain.co.uk"); 
} 

///new menu item(){ blah blah... 
... 
... 
aI("text=Set Homepage;url=javascript:doSomething(this);"); 
...}
...notice the javascript: before the doSomething, was missing that.

The other is that there is now an onClick event you can catch in the menu items. Its called clickFunction and it will execute any bit of javascript you;d like as if it was put in the onClick of the link in the menu. Good luck and sorry about that stupid error.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply