object resize problem.

in Script development
Subscribe to object resize problem. 13 posts, 3 voices



CerberusS Scriptwright
FirefoxWindows

ok im trying to get this object to resize from 600px height to 900px height but have tried many thing and can not get it to work and help would be great.

div id="game_container">

<object width="100%" height="900"></object>

 
mike cupcake Scriptwright
FirefoxMacintosh

what have you tried?

 
CerberusS Scriptwright
FirefoxWindows

function addGlobalStyle(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);
}

function resize() {

gameheight = " ";

if(document.getElementsById('simcity')[0])
{
gameheight = " 900px !important; ";
}
css += addCss("Height", gameheight);

addGlobalStyle(css);
}

 
AmpliDude Scriptwright
FirefoxWindows

There is no document.getElementsById function, use document.getElementById('simcity') and this function does not return an array, so don't refer to first element ([0]).

 
CerberusS Scriptwright
FirefoxWindows

yep it also fails as i hadnt realised it inside an iframe as well so more thinking till i get it working :(

am i thinking along right lines with this or am i as bad at this as i think i ma lol

function gameEmbed() {
var allsizes = document.getElementsByTagName('iframe_canvas');
for (var i=0;i<allsizes.length;i++)>
var currentsize = allsizes[i];
if(currentsize.height.match("600")) {
var orgsize = currentsize.height.match("600")
var newsize = "900"
currentsize.removeAttribute('height');
currentsize.setAttribute("height", newsize);
}
}
}
gameEmbed();

 
mike cupcake Scriptwright
FirefoxMacintosh

It's a flash object, right? Might be that it's actually programmed to be a fixed size, or that it will only resize when both width and height are changed.

If you're using Firefox install Firebug and try changing the height in the live page code, if that doesn't work then that approach in a script has no chance.

 
CerberusS Scriptwright
FirefoxWindows

yer i thought of that one and yes i can manually change it with firebug and it works as expected. thanks for all the help this one is driving me mad.

 
CerberusS Scriptwright
FirefoxWindows

any ideas anyone ?

 
mike cupcake Scriptwright
FirefoxMacintosh

post the full page code (maybe on pastebin to save space here) or a link to the page if it's not behind a login and I'll take a look

 
CerberusS Scriptwright
FirefoxWindows

see full page source here: http://pastebin.com/BVnBeyRS

 
mike cupcake Scriptwright
FirefoxMacintosh

There's no elements with id game_container or simcity in that code, there's a iframe_canvas but the height is not 600. I can't tell how it relates to your scripting and aren't sure which element you're trying to change - maybe the page is changed by its own javascript and you need to give us the generated sourcecode instead?

 
CerberusS Scriptwright
FirefoxWindows

ok here code taken from firebug for full page: http://pastebin.com/2RsjLYDG

this is a FB app so if your on FB you can view the live code "simcity social" http://apps.facebook.com/simcitysocial

 
mike cupcake Scriptwright
FirefoxWindows

that code begins with a DIV tag and there's no OBJECT tag in there, it isn't the full page.