The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Click on a link (at a iframe) and send the code to txtarea (on topics)

View previous topic View next topic Go down

In progress Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Chavo on April 1st 2014, 7:58 am

I've takethis codeand i've created a javascript page and applied to all pages.But the page which has thelink (a emoticon) is in a frame (host on another site), so how i can place the code of this image when i click on it on textarea of topics (main frame "_top"). I've tested it on the site i've host and it worked fine, but the problem is make it works on main frame.

Chavo
New Member

Male Posts : 19
Reputation : 2
Language : Engish, Portuguese

http://help.forumotion.com/

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Ange Tuteur on April 1st 2014, 3:36 pm

Hello Chavo,

To access an iframes contents the source must be on the same domain.

Example :
Code:
$(function() {
  $('#emoticons').load(function() {
  $('#emoticons').contents().find('img').click(function() {
  $('#textArea').val($('#textArea').val() + $(this).attr('alt'));
  });
  });
});

http://generaltesting.forumotion.com/h1-

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Chavo on April 1st 2014, 9:18 pm

And what codes i apply to iframe images? And it really must be hosted on forum?

On forumotion have an limit of maximum html modules?

Chavo
New Member

Male Posts : 19
Reputation : 2
Language : Engish, Portuguese

http://help.forumotion.com/

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Ange Tuteur on April 1st 2014, 10:14 pm

The code I posted above shows how to access the iframes html contents. For the emoticon codes, it is done by the alt text of the image. We target this attribute and insert its value into the texarea.

To access the contents of an iframe, the iframe source must be on the same domain.

The max number of HTML pages you can have is 500. Please see this topic for limits :
http://help.forumotion.com/t1709-some-limits-of-forumotion-forum

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Chavo on April 3rd 2014, 4:03 am

So, i can put a texbox inside the frame and the person get it just pressing a button...

Have a possibility to switch automatically the theme when your internet is slow.

And can apply a .css from the main frame to iframes on the page? And when switch the theme of the main frame switch on the iframe?

Chavo
New Member

Male Posts : 19
Reputation : 2
Language : Engish, Portuguese

http://help.forumotion.com/

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Ange Tuteur on April 3rd 2014, 4:16 am

If you wanted to append a stylesheet to the iframe you can do :
Code:
$(function() {
  $('#myFrame').load(function() {
  $('#myFrame').contents().find('head').append('<link type="text/css" href="/mystyle.css" rel="stylesheet">');
  });
});

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Chavo on April 4th 2014, 7:16 am

Two questions
This code will affect all pages on frame? If i go to another page it will be replaced by the theme of the page?

And how i modify this code for example make a list to choice the theme?

Chavo
New Member

Male Posts : 19
Reputation : 2
Language : Engish, Portuguese

http://help.forumotion.com/

Back to top Go down

In progress Re: Click on a link (at a iframe) and send the code to txtarea (on topics)

Post by Ange Tuteur on April 4th 2014, 6:36 pm

To apply to all frame pages you would need to append the style again, so you could do something like :
Code:
var setStyle = setInterval(function() {
  if ($('#myIframe').contents().find('#myStyle').length) return;
  $('#myIframe').contents().find('head').append('<link type="text/css" id="myStyle" href="mystyle.css" rel="stylesheet">');
},100);

You could set up a list of elements and have them run a function if clicked. You would need to clear the other functions when doing so. So, on click of the new style you would run a similar function above and kill your other intervals by calling clearInterval.

ex :
Code:
$('#mybutton').click(function() { clearInterval(setStyle) });

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum