Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Delete <div> content in firefox (http://www.programmingforums.org/showthread.php?t=11688)

Lich Oct 25th, 2006 11:38 AM

Delete <div> content in firefox
 
I have a script that changes the html in a div, the problem is that in firefox it doesn't change delete the old div content, it just amends it. So it looks pretty weird.

The page is at http://signs365.com/newsite/developm...clemagnets.php it works great in IE and Opera, but firefox has issues with it. Here's the javascript function that gives the issue

:

function minQuantity()
 {
                  var size = eval(document.magnetForm.size.value);
                  var quantityHTML = document.getElementById("quantity");
                 
                  quantityHTML.innerHTML = "";
                 
                        if(size == 2) {
                               
                                quantityHTML.innerHTML = "<select name=\"quantity\" id=\"quantity\" onchange=\"calcMagnets();\"><option value=\"1\" selected>1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option><option value=\"9\">9</option><option value=\"10\">10</option></select>";
                         
                        } else if(size == 1){

                                var quantityHTML = document.getElementById("quantity");
                                quantityHTML.innerHTML = "<select name=\"quantity\" id=\"quantity\" onchange=\"calcMagnets();\"><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"6\">6</option><option value=\"7\">7</option><option value=\"8\">8</option><option value=\"9\">9</option><option value=\"10\">10</option></select>";
                          }

 }


any thoughts?

DaWei Oct 25th, 2006 12:12 PM

You have two things with the same ID (quantity), a div and a select. I haven't looked further. I would guess things would be okay when the page loaded, but screwed up once you stuck the second "quantity" in there (the select). You'd be trying to stuff another 5 lbs of crap in a different bag.

Lich Oct 25th, 2006 1:25 PM

Quote:

Originally Posted by DaWei (Post 117497)
You have two things with the same ID (quantity), a div and a select. I haven't looked further. I would guess things would be okay when the page loaded, but screwed up once you stuck the second "quantity" in there (the select). You'd be trying to stuff another 5 lbs of crap in a different bag.

it didn't even occur to me that I did that. As always, you're the man daWei


All times are GMT -5. The time now is 1:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC