Jump to content

JS is breaking my table


aebstract

Recommended Posts

I'm a total javascript newb, here is the code that I inserted just above my table:

 

echo "<SCRIPT language=\"javascript\">
function delete_warning() {
if (confirm(\"ARE YOU SURE?\")) {
    window.location = \"http://www.google.com/\";
} else { 
}
}
</SCRIPT>";

 

Then in my table, I use this function on a form button:

 

$viewparts .= "
<tr bgcolor=\"$row_color\">
<td style=\"border-bottom: 1px solid #000;border-left: 1px solid #000;\">$partnum</td>
<td style=\"border-bottom: 1px solid #000;border-left: 1px solid #000;\" width=5></td>
<td style=\"border-bottom: 1px solid #000;\">$partname</td>
<td style=\"border-bottom: 1px solid #000;\" width=5></td>
<td style=\"border-bottom: 1px solid #000;border-left: 1px solid #000;\">$description</td>
<td style=\"border-bottom: 1px solid #000;\" width=25></td>
<td style=\"border-bottom: 1px solid #000;border-left: 1px solid #000;border-right: 1px solid #000;\">$price</td>
<td><a href=\"/prices/edit/$part_id/\"><img src=\"/images/pencil.gif\" border=\"0\" /></a><INPUT TYPE=\"image\" NAME=\"fill\" VALUE=\"Delete\" src=\"\" onClick=\"delete_warning()\" />
</td>
</tr>
";

 

The physical pop up with the allow/disallow works.. the problem is that it is breaking my table up really weirdly, see image below:

table.jpg

 

The top is the broken table with the javascript, the bottom is when I took the entire code from echo to the ; out, table back to normal. The reason I have this javascript where it is vs in the head of the page is because I am going to have to use php variables for my url in the code. Which brings me to issue #2, how do I insert a variable in to that url in my javascript? Hopefully someone knows thte answers to my issues :D

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/125944-js-is-breaking-my-table/
Share on other sites

  • 5 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.