HTML & Javascript : Open link in new tab












0















i have a little problem on a forumactif's code. this is not my own job so i'm totally lost about this way of coding... it is an HTML page (http://www.endrothroad.net/h7-page-d-accueil) and links in the scrolling box can't be opened in a new tab. on top of that, i can't change the style of the text in this box anymore. so this is the code of the HTML page.



<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />  
<title>Dernier sujet</title><base target="_parent" /> <style>
h1{
text-align: center;
font-size:14px;
color: #dd3d3d;
font-family: Trajan Pro;
width: 175px;
}
a{
text-decoration:none;
color:#ffffff !important;
font-weight:bold;
}
a:hover{
color:#ffffff !important;
}</style>
<div style="margin:-10px;">

<h1>
Derniers messages
</h1>

<div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
<iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="/portal.forum" name="frame_sjt"> </iframe>
</div><script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script><script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js" type="text/javascript"></script>
</div>


i tried with a simple "_blank" but obviously it doesn't work... if someone can help me it would be so wonderful !
ty










share|improve this question



























    0















    i have a little problem on a forumactif's code. this is not my own job so i'm totally lost about this way of coding... it is an HTML page (http://www.endrothroad.net/h7-page-d-accueil) and links in the scrolling box can't be opened in a new tab. on top of that, i can't change the style of the text in this box anymore. so this is the code of the HTML page.



    <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />  
    <title>Dernier sujet</title><base target="_parent" /> <style>
    h1{
    text-align: center;
    font-size:14px;
    color: #dd3d3d;
    font-family: Trajan Pro;
    width: 175px;
    }
    a{
    text-decoration:none;
    color:#ffffff !important;
    font-weight:bold;
    }
    a:hover{
    color:#ffffff !important;
    }</style>
    <div style="margin:-10px;">

    <h1>
    Derniers messages
    </h1>

    <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
    <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="/portal.forum" name="frame_sjt"> </iframe>
    </div><script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script><script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js" type="text/javascript"></script>
    </div>


    i tried with a simple "_blank" but obviously it doesn't work... if someone can help me it would be so wonderful !
    ty










    share|improve this question

























      0












      0








      0








      i have a little problem on a forumactif's code. this is not my own job so i'm totally lost about this way of coding... it is an HTML page (http://www.endrothroad.net/h7-page-d-accueil) and links in the scrolling box can't be opened in a new tab. on top of that, i can't change the style of the text in this box anymore. so this is the code of the HTML page.



      <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />  
      <title>Dernier sujet</title><base target="_parent" /> <style>
      h1{
      text-align: center;
      font-size:14px;
      color: #dd3d3d;
      font-family: Trajan Pro;
      width: 175px;
      }
      a{
      text-decoration:none;
      color:#ffffff !important;
      font-weight:bold;
      }
      a:hover{
      color:#ffffff !important;
      }</style>
      <div style="margin:-10px;">

      <h1>
      Derniers messages
      </h1>

      <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
      <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="/portal.forum" name="frame_sjt"> </iframe>
      </div><script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script><script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js" type="text/javascript"></script>
      </div>


      i tried with a simple "_blank" but obviously it doesn't work... if someone can help me it would be so wonderful !
      ty










      share|improve this question














      i have a little problem on a forumactif's code. this is not my own job so i'm totally lost about this way of coding... it is an HTML page (http://www.endrothroad.net/h7-page-d-accueil) and links in the scrolling box can't be opened in a new tab. on top of that, i can't change the style of the text in this box anymore. so this is the code of the HTML page.



      <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />  
      <title>Dernier sujet</title><base target="_parent" /> <style>
      h1{
      text-align: center;
      font-size:14px;
      color: #dd3d3d;
      font-family: Trajan Pro;
      width: 175px;
      }
      a{
      text-decoration:none;
      color:#ffffff !important;
      font-weight:bold;
      }
      a:hover{
      color:#ffffff !important;
      }</style>
      <div style="margin:-10px;">

      <h1>
      Derniers messages
      </h1>

      <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
      <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="/portal.forum" name="frame_sjt"> </iframe>
      </div><script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript"></script><script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js" type="text/javascript"></script>
      </div>


      i tried with a simple "_blank" but obviously it doesn't work... if someone can help me it would be so wonderful !
      ty







      javascript jquery html






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 23:14









      Roxanne NumaRoxanne Numa

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          How do I have links within my iFrame open in new tabs?



          According to Darryl Huffman's Question (How to make all links in an iframe open in new tab?), you can use jQuery to give all a elements a target of blank or select every single a element with vanilla Javascript, where both solutions will open all links in new tabs.



          Note: this doesn't across domains from the iFrame's source due to sites' behaviors.





          jQuery (You're using v1.4.2) :$('a').setAttribute('target','_blank');






          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          Javascript: window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";



          You would need to add id="iFrame to your iFrame in order to reference the iFrame as done in the sample below.






          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          How do I style within my iFrame?



          Unfortunately, unless the iFrame is on a webpage that is of the same domain as the iFrame's target you can't.



          iFrames are holes or windows within the webpage that display another website or file. They have no connection to the page that has the iFrame.



          Now, if it is on the same domain, you can access the DOM that you want to change.





          EX:



          $('iFrame').load( function() {
          $('iframe').contents().find("head")
          .append($("<style type='text/css'> a:hover { color: blue;} </style>"));
          });





          share|improve this answer
























          • Thank you for your answer ! (:

            – Roxanne Numa
            Nov 27 '18 at 11:07











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463204%2fhtml-javascript-open-link-in-new-tab%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          How do I have links within my iFrame open in new tabs?



          According to Darryl Huffman's Question (How to make all links in an iframe open in new tab?), you can use jQuery to give all a elements a target of blank or select every single a element with vanilla Javascript, where both solutions will open all links in new tabs.



          Note: this doesn't across domains from the iFrame's source due to sites' behaviors.





          jQuery (You're using v1.4.2) :$('a').setAttribute('target','_blank');






          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          Javascript: window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";



          You would need to add id="iFrame to your iFrame in order to reference the iFrame as done in the sample below.






          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          How do I style within my iFrame?



          Unfortunately, unless the iFrame is on a webpage that is of the same domain as the iFrame's target you can't.



          iFrames are holes or windows within the webpage that display another website or file. They have no connection to the page that has the iFrame.



          Now, if it is on the same domain, you can access the DOM that you want to change.





          EX:



          $('iFrame').load( function() {
          $('iframe').contents().find("head")
          .append($("<style type='text/css'> a:hover { color: blue;} </style>"));
          });





          share|improve this answer
























          • Thank you for your answer ! (:

            – Roxanne Numa
            Nov 27 '18 at 11:07
















          0














          How do I have links within my iFrame open in new tabs?



          According to Darryl Huffman's Question (How to make all links in an iframe open in new tab?), you can use jQuery to give all a elements a target of blank or select every single a element with vanilla Javascript, where both solutions will open all links in new tabs.



          Note: this doesn't across domains from the iFrame's source due to sites' behaviors.





          jQuery (You're using v1.4.2) :$('a').setAttribute('target','_blank');






          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          Javascript: window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";



          You would need to add id="iFrame to your iFrame in order to reference the iFrame as done in the sample below.






          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          How do I style within my iFrame?



          Unfortunately, unless the iFrame is on a webpage that is of the same domain as the iFrame's target you can't.



          iFrames are holes or windows within the webpage that display another website or file. They have no connection to the page that has the iFrame.



          Now, if it is on the same domain, you can access the DOM that you want to change.





          EX:



          $('iFrame').load( function() {
          $('iframe').contents().find("head")
          .append($("<style type='text/css'> a:hover { color: blue;} </style>"));
          });





          share|improve this answer
























          • Thank you for your answer ! (:

            – Roxanne Numa
            Nov 27 '18 at 11:07














          0












          0








          0







          How do I have links within my iFrame open in new tabs?



          According to Darryl Huffman's Question (How to make all links in an iframe open in new tab?), you can use jQuery to give all a elements a target of blank or select every single a element with vanilla Javascript, where both solutions will open all links in new tabs.



          Note: this doesn't across domains from the iFrame's source due to sites' behaviors.





          jQuery (You're using v1.4.2) :$('a').setAttribute('target','_blank');






          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          Javascript: window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";



          You would need to add id="iFrame to your iFrame in order to reference the iFrame as done in the sample below.






          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          How do I style within my iFrame?



          Unfortunately, unless the iFrame is on a webpage that is of the same domain as the iFrame's target you can't.



          iFrames are holes or windows within the webpage that display another website or file. They have no connection to the page that has the iFrame.



          Now, if it is on the same domain, you can access the DOM that you want to change.





          EX:



          $('iFrame').load( function() {
          $('iframe').contents().find("head")
          .append($("<style type='text/css'> a:hover { color: blue;} </style>"));
          });





          share|improve this answer













          How do I have links within my iFrame open in new tabs?



          According to Darryl Huffman's Question (How to make all links in an iframe open in new tab?), you can use jQuery to give all a elements a target of blank or select every single a element with vanilla Javascript, where both solutions will open all links in new tabs.



          Note: this doesn't across domains from the iFrame's source due to sites' behaviors.





          jQuery (You're using v1.4.2) :$('a').setAttribute('target','_blank');






          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          Javascript: window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";



          You would need to add id="iFrame to your iFrame in order to reference the iFrame as done in the sample below.






          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>







          How do I style within my iFrame?



          Unfortunately, unless the iFrame is on a webpage that is of the same domain as the iFrame's target you can't.



          iFrames are holes or windows within the webpage that display another website or file. They have no connection to the page that has the iFrame.



          Now, if it is on the same domain, you can access the DOM that you want to change.





          EX:



          $('iFrame').load( function() {
          $('iframe').contents().find("head")
          .append($("<style type='text/css'> a:hover { color: blue;} </style>"));
          });





          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>





          $('a').setAttribute('target', '_blank');

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>





          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>





          window.frames["iFrame"].getElementsByTagName("a")[0].target="_blank";

          h1 {
          text-align: center;
          font-size: 14px;
          color: #dd3d3d;
          font-family: Trajan Pro;
          width: 175px;
          }

          a {
          text-decoration: none;
          color: #ffffff !important;
          font-weight: bold;
          }

          a:hover {
          color: #ffffff !important;
          }

          <script src="https://illiweb.com/rs3/30/frm/jquery/marquee/jquery.marquee.min.js"></script>
          <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
          <div style="margin:-10px;">

          <h1>
          Derniers messages
          </h1>

          <div style="margin-top: -10px; width: 175px; height: 80px; font-size: 10px; font-family: arial;" id="dernier_sjt">
          <iframe id="iFrame" onload="var frame_sjt=window.frame_sjt.document.getElementById('comments_scroll_div');console.log(frame_sjt);document.getElementById('dernier_sjt').innerHTML=frame_sjt.innerHTML;$('.marquee').marquee();" src="http://www.endrothroad.net/h7-page-d-accueil/portal.forum"
          name="frame_sjt"></iframe>
          </div>
          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 25 '18 at 0:28









          Cody BennettCody Bennett

          266




          266













          • Thank you for your answer ! (:

            – Roxanne Numa
            Nov 27 '18 at 11:07



















          • Thank you for your answer ! (:

            – Roxanne Numa
            Nov 27 '18 at 11:07

















          Thank you for your answer ! (:

          – Roxanne Numa
          Nov 27 '18 at 11:07





          Thank you for your answer ! (:

          – Roxanne Numa
          Nov 27 '18 at 11:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53463204%2fhtml-javascript-open-link-in-new-tab%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)