Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 25th, 2006, 10:38 AM   #1
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
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?
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Oct 25th, 2006, 11:12 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Oct 25th, 2006, 12:25 PM   #3
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
Quote:
Originally Posted by DaWei View Post
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
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript and Firefox JPS JavaScript and Client-Side Browser Scripting 2 Mar 30th, 2006 10:34 AM
FireFox help? Sane Coder's Corner Lounge 17 Mar 3rd, 2006 1:37 PM
firefox vs IE, stats for programming forums big_k105 Coder's Corner Lounge 31 May 21st, 2005 11:04 AM
After execution - Error cannot locate /Skin File? wchar Visual Basic 1 Mar 5th, 2005 9:04 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:19 AM.

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