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
Share on other sites

  • 5 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.