javascript - Remove node from and replace it with new values -
How can I add tags to objects, replace their original tags with modified values, I want to run this replacement I am using
But the ultimate place is not found or has been removed. How can you recognize a particular paragraph under
? Thanks!
function autoObjectFun () {var objects = document.getElementsByTagName ('object'); Var len1 = objects Length; (Var j = 0; j & lt; len1; j ++) for {var paramObj = objects [j] .getElementsByTagName ('param'); Var len = paramObj.length; {Var srcStr = paramObj [i] .getAttribute ('name') for (Var i = 0; i & lt; len; i ++); If (srcStr == 'flashvars') {var newParamObj = document.createElement ('param'); NewParamObj = paramObj [i] .cloneNode (true); Var params = paramObj [i] .getAttribute ('value'); Var newperm = ''; Var Paramplay = 'Autoplay = 0 & amp;'; NewParamObj.setAttribute ('value', absolute); ParamObj [i] .removeNode (true); Var newObject = objects [ja] .cloneNode (true); Var parent1 = objects [j] ParentNode; NewObject.appendChild (newParamObj); Parent1.replaceChild (newObject, objects [ja]); }}}}}}
No native method removeNode () , This will be the cause of an error and will stop the execution of your statements further. Try:
paramObj [i]. ParentNode.removeChild (paramObj [i]); Instead ..
Comments
Post a Comment