PDA

View Full Version : Computer Geeks - Javascript Help



CrazyZeb
March-19th-2005, 02:47 PM
I just wanted to title it like KB, ha.

Can someone please tell me why this works in Firefox but NOT in IE?


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
id="ycblogo" width="200" height="350">
<param name="movie" value="flash/ycblogo.swf">
<param name="quality" value="best">
<param name="scale" value="exactfit">
<param name="wmode" value="transparent">
<param name="bgcolor" value="#000000">
<SCRIPT language="JavaScript">
<!--
document.write('<embed name="ycblogo" src="flash/ycblogo.swf"');
document.write('quality="best" scale="exactfit" wmode="transparent" bgcolor="#000000" swLiveConnect="true"');
if (screen.width>=1280)
{
document.write('width="200" height="350"');
}
if (screen.width>=1152 && screen.width<1280)
{
document.write('width="180" height="315"');
}
if (screen.width>=1024 && screen.width<1152)
{
document.write('width="160" height="280"');
}
if (screen.width>=800 && screen.width<1024)
{
document.write('width="125" height="218"');
}
document.write('type="application/x-shockwave-flash"');
document.write('pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
//-->
</SCRIPT>
</object>

The point of the script is to keep the logo the same size regardless of resolution.

Baculus
March-19th-2005, 07:46 PM
Quick question: Is this straight-up how the code appears, in this line order?

You may want to check the security settings in IE. This is in Tools>Internet Options>Security>Custom Level. There are several settings that make affect the running of this script in IE.

You can also download a Javascript debugger, if you don't use Visual Studio, from here:

http://www.microsoft.com/downloads/details.aspx?FamilyId=2F465BE0-94FD-4569-B3C4-DFFDF19CCD99&displaylang=en

Also, you can do a Google for "debug javascript IE errors" and get some hits as well.

I hope this helps.

CrazyZeb
March-19th-2005, 07:55 PM
Yes, that's C&P'd directly from my page.

Basically, I'm trying to use this flash (below) but keep it the same size regardless of resolution. I've tried table percentages, javascript.... everything I can think of and I thought I finally found it until I opened it up in IE. :doh: I put my security settings as low as possible and still no go.

Flash code:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
id="ycblogo" width="200" height="350">
<param name="movie" value="flash/ycblogo.swf">
<param name="quality" value="best">
<param name="scale" value="exactfit">
<param name="wmode" value="transparent">
<param name="bgcolor" value="#000000">
<embed name="ycblogo" src="flash/ycblogo.swf"
quality="best" scale="exactfit" wmode="transparent" bgcolor="#000000" swLiveConnect="true"
width="200" height="350"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>
</object>

Baculus
March-19th-2005, 08:04 PM
In this embedded in HTML, and if so, where is the code placed? Or is it in a Flash page? If it is an HTML page, is this all in the <head> of the page?

Just so I get an idea of what you are doing: You have a Flash logo, but in IE it keeps resizing?

CrazyZeb
March-19th-2005, 08:12 PM
Php/html, and its in the body of the page. Just go here (http://yourchicagobulls.com) to see it in action. First, try it in Firefox by opening it in different resolutions. It will always be the same size, while everything around it alters. It doesn't work in IE.

jenmdixon
March-19th-2005, 08:49 PM
Zeb, two questions:

1) Did you try debugging to pop an alert showing you where in the script it is taking the height/width of the image from?

2) Did you try extracting the code that detects the screen resolution out of where you have it now, and putting it above this codeblock? Try setting it up with two variables, imageHeight and imageWidth, and have the script set those variables, and then in the codeblock where you write the HTML code out to the document, you simply read those variables? Maybe there's something going on with the way that Mozilla reads that codeblock...not sure...