Aleksandrs Posted August 31, 2006 Report Share Posted August 31, 2006 Ir nepieciešams nomainīt input laukam type vērtību, uz internet explorer nesanāk nomainīt nearvienu no variantiem: document.getElementById('el1').type = 'text'; document.getElementById('el1').attributes['type'].value = 'text'; Ir ieteikumi? Link to comment Share on other sites More sharing options...
Stopp Posted August 31, 2006 Report Share Posted August 31, 2006 (edited) netestēšu, bet varbūt var tā <script> var vertiba=document.getElementById('el1').value; document.getElementById('divs').innerHTML='<input type="text" id="el1" value="'+vertiba+'">'; </script> <div id="divs"><input type="hidden" id="el1" value="jebkāda vērtība"></div> edit: notestēju, viss darbojas. tagad tikai ietaisam funkcijā un lietojam vairākos gadījumos. <script> function changetype(div_id, inp_id, wanted_type) { var vertiba=document.getElementById(inp_id).value; document.getElementById(div_id).innerHTML='<input type="'+wanted_type+'" id="'+inp_id+'" value="'+vertiba+'">'; } </script> <div id="divs"><input type="hidden" id="el1" value="jebkāda vērtība"></div><br/> <input type="button" value="mainīt tipu" onClick="changetype('divs', 'el1', 'text');"> Edited August 31, 2006 by Stopp Link to comment Share on other sites More sharing options...
bubu Posted August 31, 2006 Report Share Posted August 31, 2006 innerHTML ir fui. Labāk ar appendChild, createElement metodēm. Link to comment Share on other sites More sharing options...
PheliX Posted August 31, 2006 Report Share Posted August 31, 2006 Eksplorerim nevar input tipu nomainiit kad elements atrodas dokumentaa. neesmu testeejis vai peec atvienoshanas var mainiit, bet pirms pievienoshanas var - taa ka sanaaks vai nu innerHTML vai nu ar DOM uztaisiit jaunu un repleisot Link to comment Share on other sites More sharing options...
Stopp Posted September 2, 2006 Report Share Posted September 2, 2006 innerHTML ir fui. kāpēc ? Link to comment Share on other sites More sharing options...
v3rb0 Posted September 2, 2006 Report Share Posted September 2, 2006 tāpēc ka ar inner html vari uzsetot nodei par childu kaut ko kā "<b><i><p>inner html ir fui</b></i></table>" - ar dom tik līku htmlu gribēdams nesataisīsi. Link to comment Share on other sites More sharing options...
Recommended Posts