![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
|
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? |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 | |
|
Professional Programmer
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| JavaScript and Firefox | JPS | JavaScript and Client-Side Browser Scripting | 2 | Mar 30th, 2006 11:34 AM |
| FireFox help? | Sane | Coder's Corner Lounge | 17 | Mar 3rd, 2006 2:37 PM |
| firefox vs IE, stats for programming forums | big_k105 | Coder's Corner Lounge | 31 | May 21st, 2005 12:04 PM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 10:04 PM |