Reputation: 607
i have this text in an html doc
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="" id="movie" align="middle" height="371" width="495">
<param name="movie" value="/play/skins/flash/22753/a.swf?
movid=blfgbd&clid=22753&autoplay=true&noad=&
did=1000806817&&cache_buster=634916059503671812&session_id=806817&
break_number=0&user_id=-1&VAST=2&is_hiro=true">
<param name=...
i would want to change the last true to false is_hiro=true->is_hiro=false how can i do that?
Upvotes: 0
Views: 216
Reputation: 72957
This should work:
// Get the <param> tag.
var param = document.getElementById('movie').children[0];
// Replace the content of the param's value.
param.value = param.value.replace('is_hiro=true', 'is_hiro=false');
Please note that this assumes your param is the first child of the object.
If that's not always the case, you might be better off giving the param a id
:
<param name="movie"
id="myParameter"
value="/play/skins/flash/22753/a.swf?
movid=blfgbd&clid=22753&autoplay=true&noad=&
did=1000806817&&cache_buster=634916059503671812&
session_id=806817& break_number=0&user_id=-1&
VAST=2&is_hiro=true">
var param = document.getElementById('myParameter'); // Get the <param> tag.
param.value = param.value.replace('is_hiro=true', 'is_hiro=false');
Upvotes: 1