Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

createElement error. Custom DW Extention!

Explorer ,
May 08, 2010 May 08, 2010

I am getting this error:

Untitled-1.jpg

and here is my code, that i want to create select elements (option) by JavaScript. What code i use to create Select Options?


Just Console window saying that createElement is not JavaScript function.

function AddItem(selbox, Text, Value) {      // Create an Option object             var opt = document.createElement("option");      // Add an Option object to Drop Down/List Box      document.getElementById(selbox).options.add(opt);      // Assign text and value to Option object      opt.text = Text;      opt.value = Value; } function load_str() {      var d = new Array();      var d_v = new Array();            d[0] = '0';      d_v[0] = '0';      d[1] = '1';      d_v[1] = '1';      d[2] = '2';      d_v[2] = '2';      d[3] = '3';      d_v[3] = '3';      d[4] = '4';      d_v[4] = '4';      d[5] = '5';      d_v[5] = '5';            var frm = document.scr;            for (var i = 0; i < d.length; i++)      {           AddItem ('cboids', d, d_v)      } }

Any solutions to create Select options with JavaScript?

TOPICS
Extensions
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , May 12, 2010 May 12, 2010

You can build the HTML string for the entire (updated) select element, then overwrite the object using innerHTML.

HTH,

Randy

Translate
Adobe Employee ,
May 12, 2010 May 12, 2010

You can build the HTML string for the entire (updated) select element, then overwrite the object using innerHTML.

HTH,

Randy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 12, 2010 May 12, 2010

Thanks Randy for reply.

Actually here <select> element is Dynamic.

Some properties not working properly in DW.

CSS:

visibility:hidden;

visibility:visible;

display:none;

display:block;

display:inline;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 12, 2010 May 12, 2010

function load_str() {          visArray = new Array();      for (var i=0; i < displayNames.length; i++)      {           data += '<option value="' + elt_name + '">' + displayNames + "</option>\n";      }           data = '<select name="cboids" id="cboids">'+'<option selected>*** Select Element ***</option>'+"\n"+data+'</select>';      document.getElementById('cboids_pl').innerHTML = data;     }

I wrote this code in JavaScript and it's working 100% in DW CS5. It's create options elements via JScript without 0 errors.

-- Sag-e-Attar Junaid Atari

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 18, 2010 May 18, 2010
LATEST

Some properties not working properly in DW.

CSS:

visibility:hidden;

visibility:visible;

display:none;

display:block;

display:inline;

Dreamweaver Extensibility dialogs use the same rendering engine as Design View, so not all CSS is supported. Only a subset of the rendeing supported in Design View is supported in Extensibility dialogs.

The visibility property is only supported for position:absolute elements.

The display property is supported, but only the none, block, and inline values. You need to change the innerHtml property to get the dialog to re-render.

HTH,

Randy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines