Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-16-2009, 02:48 AM   PM User | #1
mastubbs
New Coder

 
Join Date: Jul 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
mastubbs is an unknown quantity at this point
2 actions from one link

Hi all,

Trying to something i guess is pretty basic but i cant seem to get it working. I have a page with an iframe name="grid" and on that page i am also running a mootools script which toggles a pannel.

The javascript for the pannel is:
Code:
<script type="text/javascript">
window.addEvent('domready', function(){
var mySlide = new Fx.Slide('top-panel');
$('toggle').addEvent('click', function(e){
e = new Event(e);
mySlide.toggle();
e.stop();
});
});
</script>
so this link opens the pannel
Code:
<a href="#" id="toggle">Show Panel</a>
However, i want to make a it so that one link can both call a page in the iframe AND toggle the pannel. I tried:
Code:
<a href="page_to_call.htm" target="grid" id="toggle">Show panel and call page in iframe</a>
but no joy.

I want more than one link to be able to do this (calling different pages to the iframe and each one toggling the pannel)

Can anyone help?

Thanks loads in advance for any reply.
mastubbs is offline   Reply With Quote
Old 11-16-2009, 06:26 AM   PM User | #2
seco
Regular Coder

 
seco's Avatar
 
Join Date: Nov 2008
Location: Oregon
Posts: 682
Thanks: 5
Thanked 79 Times in 77 Posts
seco has a little shameless behaviour in the past
I use jQuery. It would be something like this, not 100% perfect but it toggles and loads the external file into a div.

Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
 $('a.open').click(function(){
   $("#mydiv").toggle(function(){
    $(this).load("Untitled-2.html");
   });
 });
});
</script>

//html
<a class="open" href="#">open</a>
<div id="mydiv" style="width:100px; height:100px; display:none;"></div>
seco is offline   Reply With Quote
Old 11-16-2009, 01:59 PM   PM User | #3
mastubbs
New Coder

 
Join Date: Jul 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
mastubbs is an unknown quantity at this point
almost

Hey thanks for the reply

Unfortunatly it doesnt really work because i want to be able to click lots of links on the page, and for all of them to cause the toggle effect as well as load a page in the iframe. This example only works for one link (to open untitled-2.html)

thanks for the help though, does anyone have any other ideas?

Matt
mastubbs is offline   Reply With Quote
Old 11-16-2009, 02:42 PM   PM User | #4
seco
Regular Coder

 
seco's Avatar
 
Join Date: Nov 2008
Location: Oregon
Posts: 682
Thanks: 5
Thanked 79 Times in 77 Posts
seco has a little shameless behaviour in the past
you need to create a var with a div and link id.
seco is offline   Reply With Quote
Old 11-16-2009, 05:47 PM   PM User | #5
mastubbs
New Coder

 
Join Date: Jul 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
mastubbs is an unknown quantity at this point
hey thanks for getting back to me. Im very new to this so i have no idea what a var is. can you explain what you mean?

thanks
mastubbs is offline   Reply With Quote
Reply

Bookmarks

Tags
combine, iframe, mootools

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 PM.


Advertisement
Log in to turn off these ads.