pouncer Posted May 16, 2007 Share Posted May 16, 2007 <script> if ((screen.width == 1024) && (screen.height == 768)) { height1 = '192'; height2 = '23'; } else if ((screen.width == 1152) && (screen.height == 864)) { height1 = '247'; height2 = '248'; } </script> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="247"> <param name="movie" value="http://ghetto-fusion.com/moschino/flash.swf"> <param name="quality" value="high"> <embed src="http://ghetto-fusion.com/moschino/flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="247"></embed> </object> where the first width="100%" height="247" .. i need to somehow change it to width="100%" height="height1"> and i need to change the second one to width="100%" height="height2"> how can i put the javascript vars in the html attributes? Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/ Share on other sites More sharing options...
nogray Posted May 17, 2007 Share Posted May 17, 2007 write the whole thing using JavaScript <script language="javascript"> var txt = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100%\" height=\""+height1+"\">"; txt += "<param name=\"movie\" value=\"http://ghetto-fusion.com/moschino/flash.swf\">"; txt += "<param name=\"quality\" value=\"high\">"; txt += "<embed src=\"http://ghetto-fusion.com/moschino/flash.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"100%\" height=\""+height2+"\"></embed>"; txt += "</object>"; document.write(txt); </script> Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-254985 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 it didn't work, the flash banner disappears Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255162 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 First, give two of the element an id for each. ... width="100%" height="247" id="object_1"> ... width="100%" height="247" id="object_2"> Then now implement your js code: if ((screen.width == 1024) && (screen.height == 768)) { height1 = '192'; height2 = '23'; } else if ((screen.width == 1152) && (screen.height == 864)) { height1 = '247'; height2 = '248'; } document.getElementById("object_1").height = height1; document.getElementById("object_2").height = height2; Hope this work, bcoz i never tried out. Hope this help you. Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255316 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 nope didn't work it just didnt change the banner size when i changed my resolution Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255328 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 using that code, can i leave my <object> code in html then? Yea, just exactly the same. Just add id to each element you want to change their height. Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255334 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 nah, didn't seem to work. banner size should change when i change my resolution :s Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255340 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 i even tried this, didn;t work <script> if ((screen.width == 1024) && (screen.height == 768)) { var height = '219'; } else if ((screen.width == 1152) && (screen.height == 864)) { var height = '247'; } document.write("Your screen res is " + screen.width + "x" + screen.height); document.write("<br>"); document.write("Your height should be " + height); document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100%\" height=\"'+height+'\">'); document.write('<param name=\"movie\" value=\"http://ghetto-fusion.com/moschino/flash.swf\">'); document.write('<param name=\"quality\" value=\"high\">'); document.write('<embed src=\"http://ghetto-fusion.com/moschino/flash.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"100%\" height=\"'+height'\">'); document.write('</object>'); </script> when i do above code, everything just disappears Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255350 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 <script> if ((screen.width == 1024) && (screen.height == 768)) { height1 = '192'; height2 = '23'; } else if ((screen.width == 1152) && (screen.height == 864)) { height1 = '247'; height2 = '248'; } document.getElementById("object_1").height = height1; document.getElementById("object_2").height = height2; </script> Is this your code? If it is, so sorry i did't mention you had to put this all under a onload event. Or right before </body>. Let's try this: <script> window.onload = function(){ if ((screen.width == 1024) && (screen.height == 768)) { height1 = '192'; height2 = '23'; } else if ((screen.width == 1152) && (screen.height == 864)) { height1 = '247'; height2 = '248'; } document.getElementById("object_1").height = height1; document.getElementById("object_2").height = height2; } </script> Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255352 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 i tried that too, doesn't work if you check this page: http://ghetto-fusion.com/moschino view the source, you will see my javascript and you will also see the html underneath it, it is the html code that is displaying the flash banner.. if the javascript was working it would display 2 flash banners Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255469 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 Your height: var height = \'219\'; remove the single quote: var height = '219'; for both. Should be work. Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255544 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 huh? what you mean? my code is like this <script> window.onload = function(){ if ((screen.width == 1024) && (screen.height == 768)) { var height = '219'; } else if ((screen.width == 1152) && (screen.height == 864)) { var height = '247'; } document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='100%' height='"+height+"'>"); document.write("<param name='movie' value='http://ghetto-fusion.com/moschino/flash.swf'>"); document.write("<param name='quality' value='high'>"); document.write("<embed src='http://ghetto-fusion.com/moschino/flash.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100%' height='"+height+"'>"); document.write("</object>"); } </script> Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255576 Share on other sites More sharing options...
xenophobia Posted May 17, 2007 Share Posted May 17, 2007 I visit here: http://ghetto-fusion.com/moschino And i get that the code became: var height = \'219\'; You take a look yourself. I don't know how your CMS backend works, make sure you modified correctly. Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255611 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 hmm, when i view source i simply see var height = 219; Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255616 Share on other sites More sharing options...
pouncer Posted May 17, 2007 Author Share Posted May 17, 2007 the exact code works on its own here: http://ghetto-fusion.com/moschino/testt.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <table align="center" class="bodyline" width="90%" cellspacing="0" cellpadding="0" border="0"> <script> if ((screen.width == 1024) && (screen.height == 768)) { var height = '219'; } else if ((screen.width == 1152) && (screen.height == 864)) { var height = '247'; } document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='100%' height='"+height+"'>"); document.write("<param name='movie' value='http://ghetto-fusion.com/moschino/flash.swf'>"); document.write("<param name='quality' value='high'>"); document.write("<embed src='http://ghetto-fusion.com/moschino/flash.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100%' height='"+height+"'>"); document.write("</object>"); </script> </table> <body> </body> </html> its just not working in header.html which is like this: <br> <table align="center" class="bodyline" width="90%" cellspacing="0" cellpadding="0" border="0"> <tr> <td align="center" > <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <script> window.onload = function(){ if ((screen.width == 1024) && (screen.height == 768)) { var height = 219; } else if ((screen.width == 1152) && (screen.height == 864)) { var height = 247; } document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='100%' height='"+height+"'>"); document.write("<param name='movie' value='http://ghetto-fusion.com/moschino/flash.swf'>"); document.write("<param name='quality' value='high'>"); document.write("<embed src='http://ghetto-fusion.com/moschino/flash.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100%' height='"+height+"'>"); document.write("</object>"); } </script> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="247"> <param name="movie" value="http://ghetto-fusion.com/moschino/flash.swf"> <param name="quality" value="high"> <embed src="http://ghetto-fusion.com/moschino/flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="247"> </embed> </object> <br/> <br/> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" height="20" border="0" cellpadding="4" cellspacing="0" background="themes/fisubice/images/cellpic_nav.gif"> <tr> <td width="165" nowrap><font class="content">$theuser</font></td> <td nowrap><div align="center"><font class="content"> • <a href="index.php">Home</a> • <a href="modules.php?name=Downloads">Downloads</a> • <a href="modules.php?name=Your_Account">Your Account</a> • <a href="modules.php?name=Forums">Forums</a> • </font></div></td> <td width="165" nowrap><div align="center"><font class="content"> $datetime </font></div></td> </tr> </table></td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center"> <tr valign="top"> <td><center>$public_msg</center></td> </tr></table> <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center"> <tr valign="top"> <td valign="top" width="1" background="themes/fisubice/images/7px.gif"> header.html is part of php nuke software, its the header fr my theme Link to comment https://forums.phpfreaks.com/topic/51756-embedding-javascript-into-html/#findComment-255618 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.