aebstract Posted September 26, 2008 Share Posted September 26, 2008 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: 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 Thanks! Link to comment https://forums.phpfreaks.com/topic/125944-js-is-breaking-my-table/ Share on other sites More sharing options...
aebstract Posted September 26, 2008 Author Share Posted September 26, 2008 Actually now that I'm thinking about it, I don't even know that this code will work correctly. I need it to have a different url to go to depending on which row of the table it is on. That is where the php variables come in. Link to comment https://forums.phpfreaks.com/topic/125944-js-is-breaking-my-table/#findComment-651244 Share on other sites More sharing options...
aebstract Posted September 29, 2008 Author Share Posted September 29, 2008 ^bump^ Link to comment https://forums.phpfreaks.com/topic/125944-js-is-breaking-my-table/#findComment-652921 Share on other sites More sharing options...
darkfreaks Posted March 1, 2009 Share Posted March 1, 2009 fixed: function delete_warning() { if (confirm("ARE YOU SURE?")) { window.location = "http://www.google.com"; } else { } } Link to comment https://forums.phpfreaks.com/topic/125944-js-is-breaking-my-table/#findComment-774046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.