Hi
I write the below javascript code for populating some values and add it to the combo box this function is working in IE and its not working in an other brower. I run the web page in IE all the populating values added in the combo box and I run the page in mozilla no values add in the combo box.This is very urgent requirement for my project kindly tell any solution for the above issue.
function FeaturedSpaceContainerListController(containerSelectList, featuredSpaceSelectList, allPagesText, allFeaturedSpacesText, selectedFeaturedSpaceID, mode, onFeaturedSpaceChange)
{
// allPagesText is the text to be used for the 'all' option in the container list (the first item).this.allPagesText = allPagesText; this.allFeaturedSpacesText = allFeaturedSpacesText; // onFeaturedSpaceChange is a callback method that, if supplied, will be called whenever *a feature space* is selected (*not* when 'all featured spaces' is selected).if(onFeaturedSpaceChange) { this.onFeaturedSpaceChange = onFeaturedSpaceChange; }this.UpdateContainerSelection = function()
{
var selContainers = this.listController.selContainers;var selFeaturedSpaces = this.listController.selFeaturedSpaces;var selectedFeaturedSpaceID = selFeaturedSpaces.options[selFeaturedSpaces.selectedIndex].value; var containerIDForSelectedFeaturedSpace;
if(selectedFeaturedSpaceID == 0)
{
return; //Looks like we're in search mode and the user has chosen "All featured spaces" - the container selection // does not change in this case.}
for(var i = 0; i < GetNumFeaturedSpaces(); i+=3)
{
if(arrFeaturedSpaces[i+1] == selectedFeaturedSpaceID){
containerIDForSelectedFeaturedSpace = arrFeaturedSpaces[i];
break;}
}
for(var i = 0; i < selContainers.options.length; i++)
{
if(selContainers.options[i].value == containerIDForSelectedFeaturedSpace){
selContainers.selectedIndex = i;
this.listController.PopulateFeaturedSpacesList(selFeaturedSpaces, containerIDForSelectedFeaturedSpace);break;}
}
}
this.PopulateFeaturedSpacesList = function(){
var selContainers = this.listController.selContainers;var selFeaturedSpaces = this.listController.selFeaturedSpaces;var selectedContainerID = selContainers.options[selContainers.selectedIndex].value;
var selectedFeaturedSpaceID = -1;if(selFeaturedSpaces.selectedIndex >= 0 && selectedContainerID > 0)
{
selectedFeaturedSpaceID = selFeaturedSpaces.options[selFeaturedSpaces.selectedIndex].value;
}
while(selFeaturedSpaces.options.length > 0)
{
selFeaturedSpaces.options.remove(0);
}
if(selectedContainerID == 0 || this.listController.mode == "search"){
var featuredSpaceOption = document.createElement("OPTION");selFeaturedSpaces.options.add(featuredSpaceOption);
featuredSpaceOption.innerText = this.listController.allFeaturedSpacesText;featuredSpaceOption.value = 0;
featuredSpaceOption.selected = true;}
for(var i = 0; i < GetNumFeaturedSpaces(); i+=3)
{
var containerID = arrFeaturedSpaces[i]; var featuredSpaceID = arrFeaturedSpaces[i+1];var featuredSpaceName = arrFeaturedSpaces[i+2];if(selectedContainerID == 0 || selectedContainerID == containerID)
{
var featuredSpaceOption = document.createElement("OPTION");selFeaturedSpaces.options.add(featuredSpaceOption);
featuredSpaceOption.innerText = featuredSpaceName;
featuredSpaceOption.value = featuredSpaceID;
if(featuredSpaceID == selectedFeaturedSpaceID){
featuredSpaceOption.selected = true;}
}
}
if(selFeaturedSpaces.selectedIndex >= 0 && selFeaturedSpaces.options[selFeaturedSpaces.selectedIndex].value > 0){
//A real featured space is now selected so call the featured space change callback.this.listController.CallFeaturedSpaceSelectionChangeCallback();}
}
this.SelectFeaturedSpace = function(featuredSpaceID){
var selFeaturedSpaces = this.listController.selFeaturedSpaces;for(var i = 0; i < selFeaturedSpaces.options.length; i++)
{
if(selFeaturedSpaces.options[i].value == featuredSpaceID){
selFeaturedSpaces.selectedIndex = i;
if(featuredSpaceID > 0){
this.listController.HandleFeaturedSpaceSelectionChange();}
break;}
}
}
this.SelectContainer = function(selectedContainerID)
{
//Call this only when you want to force a container selection.var selContainers = this.listController.selContainers;var selFeaturedSpaces = this.listController.selFeaturedSpaces;for(var i = 0; i < selContainers.options.length; i++)
{
if(selContainers.options[i].value == selectedContainerID){
selContainers.selectedIndex = i;
this.listController.PopulateFeaturedSpacesList(selFeaturedSpaces, selectedContainerID);break;}
}
}
this.PopulateContainersList = function(selectedContainerID)
{
var selContainers = this.listController.selContainers;while(selContainers.options.length > 0)
{
selContainers.options.remove(0);
}
var containerOption = document.createElement("OPTION");selContainers.options.add(containerOption);
containerOption.innerText = this.listController.allPagesText;containerOption.value = 0;
if(selectedContainerID == 0){
containerOption.selected = true;}
for(var i = 0; i < GetNumContainers(); i+=2)
{
var containerID = arrContainers[i];var containerName = arrContainers[i+1];var containerOption = document.createElement("OPTION");
selContainers.options.add(containerOption);
containerOption.innerText = containerName;
containerOption.value = containerID;
if(containerID == selectedContainerID){
containerOption.selected = true;}
}
}
sweety.s
![]() |
0 |
![]() |
Go thru the following URL :
http://www.tek-tips.com/faqs.cfm?fid=5748
CSR
~ Please Mark as Answer if it solves your query ~
![]() |
0 |
![]() |
It is very difficult to detect the problem from your code as it contains huge no of lines. As you know your project vry well, it might be easier for you to debug. Or you can tell us where (e,g. in which line ) do you have the problem?
Or, you can try to use FireBug addons for FireFox.
Thanks.
HOQUE MD.NAZMUL
[document.getReaders]
![]() |
0 |
![]() |
To find out why it does not work in Firefox, invoke "Error Console" using the keyboard shortcut Ctrl+Shift+J or access that option from the Tools menu while you have opened your web page.
The Error Console will display Errors & Warnings related to CSS & Javascript that Firefox does not like possibly because the web page has some non-standard construct or erroneous code. Along with the helpful Error or Warning message, it also displays the file name as a hyperlink (to let you jump directly to the source) & line number in the source code that is causing it. There is a high probability that resolving these Errors & Warnings would make the page render fine.
M.V. 'Anil' Radhakrishna
Web Development Tips, Tricks & Trivia | My Code Gallery
Recent article - How To Create a Custom IE8 Accelerator
![]() |
0 |
![]() |
IE is the only one that uses innerText
var containerOption = document.createElement("OPTION");
selContainers.options.add(containerOption);
containerOption.innerText = this.listController.allPagesText;
containerOption.value = 0;it should read
var containerOption = document.createElement("option");
selContainers.options.add(containerOption);
containerOption.text = this.listController.allPagesText;
containerOption.value = 0;Another way to do it is in one line
var containerOption = new Option( this.listController.allPagesText, 0);
Eric
Pascarello.com | Twitter epascarello | LinkedIn
![]() |
0 |
![]() |