PDA

View Full Version : Scripting Iframes



wolfsteritory
11-03-2010, 02:15 PM
ok, so here it is , i need help solving this problem :

so u can get a general idea i want to do something similar with that which geasemonkey does
but from a webpage

1:
.............i have this iframe...................
<div style="position: absolute; width: 893px; height: 162px; z-index: 99; left: -11px; top: -2px" id="layer2">

<iframe name="I2" src="http://s9.ro.ikariam.com/index.php?view=city" width="1013" height="604" marginwidth="1" marginheight="1" border="0" frameborder="0" align="top">

</iframe></div>

..................i want to include this script : .................
function addNewStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}

addNewStyle('#city #container .phase1, #city #container .phase2, #city #container .phase3, #city #container .phase4, #city #container .phase5, #city #container .phase6, #city #container .phase7, #city #container .phase8, #city #container .phase9, #city #container .phase10, #city #container .phase11, #city #container .phase12, #city #container .phase13, #city #container .phase14, #city #container .phase15, #city #container .phase16, #city #container .phase17, #city #container .phase18, #city #container .phase19, #city #container .phase20, #city #container .phase21, #city #container .phase22, #city #container .phase23, #city #container .phase24, #city #container .phase25, #city #container .phase26, #city #container .phase27, #city #container .phase28, #city #container .phase29, #city #container .phase30, #city #container .phase31, #city #container .phase32, #city #container .phase33, #city #container .phase34, #city #container .phase35, #city #container .phase36, #city #container .phase37, #city #container .phase38, #city #container .phase39, #city #container .phase40, #city #container .phase1012 {background-image:url(http://www.web3designstudio.com/ikariam/2.jpg);}');
addNewStyle('#city #container #mainview #locations .wall .buildingimg {background-image:url();}');


...............so it will affect the iframe .................






so far no success

ive also tried something similar but also doesnt work

<script type=text/javascript>




var head = document.createElement("iframe"); head.setAttribute('id', 'ifrm');
document.body.appendChild(head);
head.setAttribute('src', 'http://s9.ro.ikariam.com/index.php?view=city');

document.getElementById("ifrm").height="1600";
document.getElementById("ifrm").width="1000";
document.getElementById("ifrm").frameBorder="0";
document.getElementById("ifrm").scrolling="no";
document.getElementById("ifrm").align="center";
document.getElementById("ifrm").float="top";



function addNewStyle(css) {
var head2, style;
head = document.getElementById('ifrm')[0];
if (!head2) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head2.appendChild(style);
}

addNewStyle('#city #container .phase1, #city #container .phase2, #city #container .phase3, #city #container .phase4, #city #container .phase5, #city #container .phase6, #city #container .phase7, #city #container .phase8, #city #container .phase9, #city #container .phase10, #city #container .phase11, #city #container .phase12, #city #container .phase13, #city #container .phase14, #city #container .phase15, #city #container .phase16, #city #container .phase17, #city #container .phase18, #city #container .phase19, #city #container .phase20, #city #container .phase21, #city #container .phase22, #city #container .phase23, #city #container .phase24, #city #container .phase25, #city #container .phase26, #city #container .phase27, #city #container .phase28, #city #container .phase29, #city #container .phase30, #city #container .phase31, #city #container .phase32, #city #container .phase33, #city #container .phase34, #city #container .phase35, #city #container .phase36, #city #container .phase37, #city #container .phase38, #city #container .phase39, #city #container .phase40, #city #container .phase1012 {background-image:url(http://www.web3designstudio.com/ikariam/2.jpg);}');
addNewStyle('#city #container #mainview #locations .wall .buildingimg {background-image:url();}');
</script>




..............i need a method to run scripts on iframes , not just that one ...... something in general ...................




Thank You

wolfsteritory
11-14-2010, 12:14 PM
nothing yet ?

there's no java guru to give me a hand ?