Guys,
The following test code uses the Javascript innerHTML method to change text in a table. The code works correctly if there are no double quotes in the string ($new_str) used by innerHTML. However, the <button> line of code contains both single and double quotes, which causes the innerHTML method to fail. Commenting out the <button> line of code produces the desired results.
Is there a way around this single / double quote issue???
$str .= "<table border=0>";
$str .= "<tr><td id='main_page_details_code'>default</td></tr>";
$str .= "</table>";
echo($str);
sleep(2);
$str = "<table class=tblf width='100%' cellspacing=0 cellpadding=0 border=0>";
$str .= "<tr><td class=txt12_c>New Text</td></tr>";
$str .= "</table><br>";
$str .= "<button type='button' class=txt12_c onClick=\"window.location='google.com'\">Google</button>";
_main_page_details_code_text_swap($str); //'new text'
function _main_page_details_code_text_swap($new_str){
echo("<script type='text/javascript'>document.getElementById('main_page_details_code').innerHTML=\"" . $new_str . "\"</script>");
}