replace text and its hyperlink in a table

hi

i have attached table view being displayed from a source in a webpage. at the bottom of the table is a text that indicates disclaimer (it has its hyperlinks). i need to remove the text and its hyperlink for the following html formatted text:

<div style=text-align:right; border:none><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>

how can i do this in javascript or ajax and have it working in IE, Firefox and chrome.
inv.jpg
eawebAsked:
Who is Participating?
 
eawebConnect With a Mentor Author Commented:
Hi, i found the error. The ajax code was misplaced. It needed to be placed just under the retrieved table containing the disclaimer text. here the solution:

***********************************
<script language="JavaScript" type="text/javascript" src="includes/js/jquery-1.7.1.min.js"></script>

<script language='JavaScript' >
document.write('<table  cellpadding="0" cellspacing="0" align="center" style="border-width: 1px;  border-style: solid; border-color: #CCCCCC;">');
document.write('<tr><td>');
document.write('<table border="0" align="center" >');
document.write('<!-- MarketWatch market summary -->');
document.write('<tr><td>');
document.write('<link rel="stylesheet" href="https://custom.gtm.idmanagedsolutions.com/custom/alliance/ii/alliancestyle.asp?siteid=D33E5570-0390-4BA1-ADE2-0DFC506881F0" type="text/css" media="all"><form method="GET">');
</script>

<script language='JavaScript' > 
function getMWArgs(){

        var args = new Object();                //object for storing param=value pairs
        var query = location.search.substring(1); //grab the text after the '?'
        var pairs = query.split("&");           //create an array of param=value pairs
      var newstring = "";

         for(var i = 0; i < pairs.length; i++){ //loop through the array
                var pos = pairs[x].indexOf('='); //check for an '='
                if (pos == -1) continue; //no '=', skip this array dimention
                var argname = pairs[x].substring(0,pos); //extract parameter name
                //skip parameters that are hard coded in the calling script block
if(argname.toLowerCase() != "siteid" && argname.toLowerCase() != "urlpull" && argname.toLowerCase() != "exstyle"){
                        newstring += pairs[x] + "&"  //concatenate the new string
                }
        }


        return newstring;
}


document.write ('<' + "script language=\"JavaScript\" type=\"text/javascript\" src=\"https://custom.gtm.idmanagedsolutions.com/custom/alliance/ii/dquote.asp?siteid=5F70B991-2B67-4808-940C-8BB73A9D4B54&urlpull=<#itm_text name="INV_URLPULL_ITMVI_BALINQRECEIPT95">&exstyle=t");

if (location.search.toString().indexOf("symb") != -1) {
      if (location.search.toString().indexOf("osymb") == -1) {
      //hit
            //alert("symb but no osymb");      
      } else {
            document.write('&symb=djia&"');
      }
} else {
      document.write('&symb=djia&"');
}

document.write(getMWArgs());
document.write("\">" );

document.write("</");
document.writeln("script>");

$(document).ready(function() {
      $(":contains('disclaimer'):last", "table").parents("td:first").html("<div style=text-align:right; border:none><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>");
      });

</script>
0
 
eawebAuthor Commented:
i am testing below ajax code but it doesn't work 100 percent.

using (jquery-1.7.1.min.js)

$(document).ready(function() {
      $(":contains('disclaimer'):last", "table").parents("td:first").html("<div style=text-align:right; border:none><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>");
      });

without it everthing works fine even in firefox and chrome. with working fine i mean the data is being displayed with the disclaimer text.
when i try to use it to replace the disclaimer text it doesn't work in firefox or chrome and for anthor account it doesn't display the data..
0
 
ProculopsisCommented:
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>
 
  <script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
 
<style type='text/css'>
    .disclaimer { display: none; }
  </style>
 
<script type='text/javascript'>//<![CDATA[
$(function(){
$('#test').click(function() {
    $("a:contains(disclaimer)").replaceWith($(".disclaimer").toggle());
    $(this).attr({disabled: true});
});
});//]]>  

</script>


</head>
<body>
  <div class="disclaimer" style="text-align:right; border:none;"><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>

<input id="test" type="button" value="Test" />

<a href="#">disclaimer</a><img src="http://filedb.experts-exchange.com/incoming/2012/03_w12/561331/inv.jpg" />
 
</body>
</html>
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
MrunalConnect With a Mentor Commented:
Check that if the object you are accessing by:
$(":contains('disclaimer'):last", "table").parents("td:first")
is getting properly.
Something you are getting undefined in this selector.

Can you share your html also so that we can give you exact solution?

If you are getting that object correctly, then instead of directly assigning its html value, first clear its contents then assign html to it.
0
 
eawebAuthor Commented:
Proculopsis, the table row containing the disclaimer text didn't change.
Please find attached the script i am using. As you will see in the code, the table is being retrieved from another source.
Document2.txt
0
 
eawebAuthor Commented:
it's how i solved it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.