$ie = new-object -com internetexplorer.application
$ie.visible = $true
$ie.navigate2("http://example.com/")
while($ie.busy) {start-sleep 1}
$ie.Document.body.innerHTML = $ie.Document.body.innerHTML + "<div id=`"a`" onclick=`"var th = document.getElementsByTagName('body')[0];var s = document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src','http://code.jquery.com/jquery-1.4.2.min.js');th.appendChild(s);`">hello</div>"
$ie.Document.getElementById("a").click()
$ie.Document.body.innerHTML = $ie.Document.body.innerHTML + "<div id=`"x`" onclick=`"`$('a').hide()`">hello</div>"
$ie.Document.getElementById("x").click()