Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Run javascript from menu item choice.
jem
Junior Member

Posts: 2
Registered: 9/15/2009
Location: Perth, Western Australia
Member Is Offline
posted on 9/15/2009 at 10:52 AM Reply With Quote
Run javascript from menu item choice.


OK, either my programming is a bit rusty (highly possible) OR I'm missing something.

What I am trying to do is clean up our website from using iFrames to CSS.

I have setup a 3 column, header footer layour using CSS DIV's.
What I am now trying to do is make the menu item choices only change the CONTENT DIV. I tried a simple javascript as per the example in the documentation and it does not run.

Here is the code for the main page

<div id="Header">
<div align="center">Header
<script type="text/javascript">
<!--
new menu (MENU_ITEMS, MENU_TPL);
//-->
</script>
</div>
</div>
<div class="threecol">
<div class="colmid">
<div class="colleft">
<div class="col1">
<!-- Column 1 start -->
<h2>Main</h2>
<!-- Column 1 end -->
</div>
<div class="col2">
<!-- Column 2 start -->
<?php
include('sidebar_left.php');
?>
<!-- Column 2 end -->
</div>
<div class="col3">

<!-- Column 3 start -->
<?php
include('sidebar_right.php');
?>

<!-- Column 3 end -->
</div>
</div>
</div>
</div>
<div id="footer">
<h2>Footer</h2>
</div>

And here is the item.js code

/* Tigra Menu items structure */
var MENU_ITEMS = [
['Home', null],
['Products', null, null,
['test div link', 'javascript:action("Hello World!");'],
['test mail to', 'mailto:[email protected]']
]
];


The mailto works but the javascript does not.
When I goto click on the 'test div likn' I get no response.
The status bar shows 'javascript:action(' and that is all. it should show javascript:action("Hello World!");

Any help would be appreciated
Thanks
View User's Profile View All Posts By User U2U Member
jem
Junior Member

Posts: 2
Registered: 9/15/2009
Location: Perth, Western Australia
Member Is Offline
posted on 9/15/2009 at 11:56 AM Reply With Quote

OK, I changed the text slightly to swap ' and " as follows

ORIGINAL LINE

['test div link', 'javascript:alert("Hello World!");'],


NEW LINE

['test div link', "javascript:alert('Hello World!');"],

and now it works fine.

Any suggestions as to why?
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Functionality demos Functionality demos
Multiple
Cross-framed
Select-boxes
Effects
Design demos Design demos
Icons & arrows
Idea!
Hi there!
Matrix
MS Style
XP Style
Dots
3D-Buttons
Product Documentation Documentation
Documenation Page
Change Log
Menus Comparison Table
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004