Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox equivalent of insertAdjacentHTML 1

Status
Not open for further replies.

tmcneil

Technical User
Nov 17, 2000
294
US
I have a combo box on an asp page that is being passed into a function that will create a text input box inside the drop down box for data entry.

Code:
<select id="messageComboBoxID" size="1" style="width: 375; position:absolute;" tabindex="4" onChange="messageComboBox.processComboBoxSelect();">
  <option value="Background Message No. 1" >Background Message No. 1</option>
  <option value="Allow trains to come to a complete stop before boarding." >Allow trains to come to a complete stop before boarding.</option>
  <option value="PLEASE BE CAREFUL... Wait for the train to stop." >PLEASE BE CAREFUL... Wait for the train to stop.</option>
  <option value="NO SMOKING... Thank you for your consideration." >NO SMOKING... Thank you for your consideration.</option>
  <option value="PLEASE BE CAREFUL... Stay clear of the doors." >PLEASE BE CAREFUL... Stay clear of the doors.</option>
  <option value="PLEASE BE CAREFUL... Watch your step." >PLEASE BE CAREFUL... Watch your step.</option>
  <option value="PLEASE BE CAREFUL... Stay behind the safety line." >PLEASE BE CAREFUL... Stay behind the safety line.</option>
  <option value="Please see attendant for route information." >Please see attendant for route information.</option>
</select>

abbreviated javascript function.
Code:
function ComboBoxObject(strDropDownListID, strComboBoxName)
{
    this._myDropDownList = document.getElementById(strDropDownListID);
    this._myDropDownList.selectedIndex = -1;

    // more code here

    var strInputCellID = strDropDownListID + "_text";
    
    var strInputCell = "<INPUT type='text' id=" + strInputCellID + 
		       " name=" + strInputCellID +
		       " onblur='" + strComboBoxName + ".handleData()' " + 
		       " onkeyup='" + strComboBoxName + ".doLookup()' " +
		       " style='display: none; position: absolute' value='' >";

    this._myDropDownList.insertAdjacentHTML("afterEnd", strInputCell);  // error here

    //more code here
}

The insertAdjacentHTML call is an IE only solution so I am looking for the equivalent to place strInputCell into myDropDownList.

Todd
 
Dwarfthrower,

It worked like a charm. Thanks a lot. I've got other javascript errors in FF but now I can enter in text like I wanted to. I'm not sure if my errors will create a problem, but it looks like everything else is working like it should.

Thanks again,
Todd
 
Glad to help mate.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Enable Apps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top