Change

Change

Hi everyone

I'm trying to combine two codes.

1.) Code for append parameter to every href:

  1. $(function() {   
  2. $("a").attr('href', function(i, h) {     
  3.       return h + (h.indexOf('?') != -1 ? "&ajax=1" : "?ajax=1");   
  4.       });
  5. });

Source (http://stackoverflow.com/questions/2667551/add-parameter-to-links-on-page-using-jquery)

2) Code to make selection within a iframe

  1. $("iframe").contents().find("textarea").keydown(...)

Source (http://stackoverflow.com/questions/2893280/jquery-select-iframe-children)

So this is my code:

  1. <html>
  2. <head>                                                                 
  3. <script type="text/javascript" src="jquery-1.9.1.min.js"></script>          
  4. <script type="text/javascript">                                         
  5. $(document).ready(function () {
  6.    $("#content_ifr").contents().find("a").attr('href', function(i, h) {
  7.      return h + (h.indexOf('?') != -1 ? "&para1=value1" : "?para1=value1");
  8.    });
  9. });
  10.  </script>  
  11.  </head>                                                                 
  12.  <body>                                                                  
  13. <iframe id="content_ifr" src="http://www.test.com" width="100%" height="100%" name="SELFHTML_in_a_box">
  14.   <p>No iframe supported!
  15. </iframe>                                     
  16.  </body>                                                                 
  17.  </html>

However, this doesn't work. Can someone help me please?

Kind regards

querynewbie (damn, I forgot the 'j' at signin ;)