rafi wiener
rafi wiener

Reputation: 607

edit html using greasemonkey

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&amp;clid=22753&amp;autoplay=true&amp;noad=&amp;
    did=1000806817&amp;&amp;cache_buster=634916059503671812&amp;session_id=806817&amp;
    break_number=0&amp;user_id=-1&amp;VAST=2&amp;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

Answers (1)

Cerbrus
Cerbrus

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&amp;clid=22753&amp;autoplay=true&amp;noad=&amp;
        did=1000806817&amp;&amp;cache_buster=634916059503671812&amp;
        session_id=806817&amp; break_number=0&amp;user_id=-1&amp;
        VAST=2&amp;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

Related Questions