473,473 Members | 1,776 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

image size reading problems with firefox javascript

3 New Member
I can't seem to get firefox to read the image size in my javascript. It will work in IE and firefox but firefox will not read the image size. Can anyone see the problem in my code? I am new to programming and not very good at it yet.:

[HTML]<HTML>
<HEAD>
<script language="JavaScript">
//-- Generate a random number between 0 and max.
function randomNum(max) {
var rNum=NaN
while (isNaN(rNum)) {
rNum=Math.floor(Math.random()*(max))
}
return rNum
}

var sound = new Array()
sound[0]= "banners/ad108s.swf"
sound[1]= "banners/pattern.swf"
sound[2]= "banners/math.swf"
sound[3]= "banners/font.swf"
sound[4]= "banners/banner.swf"
sound[5]= "banners/dolchbook.swf"
sound[6]= "banners/muscle.swf"
sound[7]= "banners/store.swf"
sound[8]= "banners/dolch.swf"
sound[9]= "banners/shoe.swf"
sound[10]= "banners/music.swf"
sound[11]= "banners/font.swf"
sound[12]= "banners/font.swf"
sound[13]= "banners/math.swf"
sound[14]= "banners/mathsheet.swf"
sound[15]= "banners/font.swf"
sound[16]= "banners/printpicture.swf"
sound[17]= "banners/calendar.swf"

</script>




</HEAD>
<BODY >

<p>

<script language="JavaScript">
soundFile=sound[randomNum(sound.length)]
//-- Decide whether to use embed or bgsound.

document.writeln ("<center><OBJECT classid\='clsid\:D27CDB6E\-AE6D\-11cf\-96B8\-444553540000'" +

"codebase\='http:\/\/download\.macromedia\.com\/pub\/shockwave\/cabs\/flash\/swflash\.cab\#version\=5,0,0,0'"+
"WIDTH=500 HEIGHT=90><PARAM NAME\=movie VALUE\="+soundFile+">"+
"<PARAM NAME\=quality VALUE\=high> <PARAM NAME\=bgcolor VALUE\=\#000000>"+
"<EMBED src\= "+soundFile+" quality\=high bgcolor\=\#000000"+
"WIDTH" + "=" + "500 HEIGHT " + "=" + "90 TYPE\='application\/x-shockwave-flash'"+
"PLUGINSPAGE\='http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version\=ShockwaveFlash'>"+
"</EMBED></OBJECT></center>")



</script>[/HTML]


Thanks for your help!
Aug 31 '07 #1
5 3745
acoder
16,027 Recognized Expert Moderator MVP
Welcome to TSDN!

That looks like code to play sound. Where's the code that checks the image size?

Is the image a local image?
Aug 31 '07 #2
johnric
3 New Member
The variable is called soundFile as I copied some code from a sound javascript but it refers to the array above and randomly selects one of the .swf flash files. It is the width and height tags that are not being read in the javascript document.write.
Would you know why firefox will not read these tags.
Thanks,
John
Aug 31 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
That code is trying to set the width and height to 500 and 90 respectively. Try adding some units, e.g. "px".
Sep 1 '07 #4
johnric
3 New Member
I tried adding px to the height and width but it didn't work.
Thanks for the idea though.
You can see the code working at http://www.netrover.com/~kingskid/108_05janflash1.html
Sep 1 '07 #5
drhowarddrfine
7,435 Recognized Expert Expert
You have 20 html errors and I'm guessing the missing end tags might be messing up the DOM tree. Also, your doctype is incomplete putting IE into 'quirks mode'.

In addition, this is incorrect:
<script language="JavaScript">

It should be <script type="text/javascript">
Sep 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: http://links.i6networks.com | last post by:
I need to display pictures, but only as large as AxB. If it is smaller than AxB, then I will display it in the original size, if it is larger than AxB, I will resize it. However, if the size is...
1
by: zelnugget | last post by:
I'm using a fading image script that I found via Google Groups on this newsgroup, and am having some difficulty with it. First, here's a link to the Google Groups posting: ...
4
by: Bob Richardson | last post by:
Is it possible for an image to SHRINK (both height and width, keeping same h/w ratio) when the browser's width is reduced? It's easy to have both h & w increase, as needed, to fill up 100% of the...
5
by: Csaba Gabor | last post by:
Is there any way to determine the pixel height and width of an original image? Specifically, If I have <IMG id=myImg src="pic.jpg" height=200 width=300> can I figure out what the original size...
5
by: Richard Shewmaker | last post by:
Hi. I've been using CSS for basic stuff, mostly concerning fonts. I want to get going with using CSS fully. Two days ago I purchased O'Reilly's "Cascading Style Sheets" and "CSS Cookbook." I've...
3
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image'...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
2
by: spinow | last post by:
Hi there, My current project has a div with a table inside it. In this table I have a cell. In this cell images are loaded using a javascript function and the images are resized to fit the cell with...
3
by: kayahr | last post by:
Hi there, I have a strange problem in Internet Explorer (IE6 and IE7). I'm writing a JavaScript application which allows the user to edit a photo composition. So when the user selects a photo then...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.