473,809 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Image works in FX, not IE?

Page: http://www.doublooncove.com/signup.php

Problem: In Firefox, the changes work fine. In IE, the images just
disappear, and there is a broken image. The images are THERE. Some are
blank images (like placeholders, since the male character is shirtless,
his shirt is blank). But they do exist.

Here is a sample of the code, there are several of these functions but
they're all the same just different parts.

CODE
function change_gender() {
if(!document.im ages){
return
}else{

document.images .bodygender.src ="http://www.doublooncov e.com/images/pirates/"
+
document.signup .gender.options[document.signup .gender.selecte dIndex].value
+ "/" +
document.signup .gender.options[document.signup .gender.selecte dIndex].value
+ ".gif"
document.images .hairback.src=" http://www.doublooncov e.com/images/pirates/"
+
document.signup .gender.options[document.signup .gender.selecte dIndex].value
+ "/hair/" +
document.signup .hair.options[document.signup .hair.selectedI ndex].value
+ "/hair_" +
document.signup .hair.options[document.signup .hair.selectedI ndex].value
+ "_" +
document.signup .hair_color.opt ions[document.signup .hair_color.sel ectedIndex].value
+ "_back.gif"
document.images .hairfront.src= "http://www.doublooncov e.com/images/pirates/"
+
document.signup .gender.options[document.signup .gender.selecte dIndex].value
+ "/hair/" +
document.signup .hair.options[document.signup .hair.selectedI ndex].value
+ "/hair_" +
document.signup .hair.options[document.signup .hair.selectedI ndex].value
+ "_" +
document.signup .hair_color.opt ions[document.signup .hair_color.sel ectedIndex].value
+ "_front.gif "
*snip*
}
}

CODE

<td><b>Gender :</b></td>
<td>
<select size="1" name="gender" onChange="chang e_gender()">
<?
if($info['gender'] == 'female'){
print '<option select>female</option>';
print '<option>male</option>';
}else{
print '<option select>male</option>';
print '<option>female </option>';
}
?>
</select>
</td>
Any ideas?

Jun 4 '06 #1
4 1307
Jessica wrote:
Problem: In Firefox, the changes work fine. In IE, the images just
disappear, and there is a broken image. The images are THERE. Some are
blank images (like placeholders, since the male character is
shirtless, his shirt is blank). But they do exist.


1. For the gender select, you don't define a value. So, instead of
referencing:

document.signup .gender.options[...].value

You should reference:

document.signup .gender.options[...].text

2. @ line 219 of rendered code: <option select>male</option>

This should be either:

<option selected>male</option>

Or (even better and complient with the specified doctype):

<option selected="selec ted">male</option>

3. @ line 206 of rendered code: <img src="'.$url.'ha t_'.$hat.'.gif"
(unparsed PHP code)

In general, run your page through an XHTML validator, because as it is now,
it's currently not valid.
JW
Jun 4 '06 #2

Jessica wrote:
Page: http://www.doublooncove.com/signup.php

Problem: In Firefox, the changes work fine. In IE, the images just
disappear, and there is a broken image. The images are THERE. Some are
blank images (like placeholders, since the male character is shirtless,
his shirt is blank). But they do exist.


Check your HTML. The options in the gender select box have no values
assigned. If you alert the .src you get: .......pirates//.gif

Also, lose the HTML comments inside the script tags, as they are not
required and in your case incorrect, causing Opera to complain.

There may be more errors than these.

Jun 4 '06 #3
Thank you both so much, it works perfectly now!

The html comments were there because my fiance told me it would prevent
browsers that didn't support the code from trying to read it. So this
is not needed?

Again, thanks a ton, now I can finally let my IE users pick their
character :)

Jun 5 '06 #4
Jessica Parker said the following on 6/4/2006 8:39 PM:
Thank you both so much, it works perfectly now!
Please quote what you are replying to.

If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
The html comments were there because my fiance told me it would prevent
browsers that didn't support the code from trying to read it. So this
is not needed?


No, it is not needed and in XHTML it can be disastrous.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
16219
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what I've come up with. In this example, there are 5 images (0 thru 4) all with a height of 80px. When you mouse over an image, it changes the growingImage variable equal to the number of the image you mouse over, when you mouse out, it sets it to 5,...
3
3457
by: Geoff Soper | last post by:
I'm trying to dynamically change the cursor of a couple of maps over an image. Basically the image is in an online photo system where there is a rotate mode. In this mode clicking on the left or right half of the image rotates it 90 degrees to the left or right. I want to change the cursor to indicate this but only while in the rotate mode. After looking at it in the Mozilla DOM inspector it seems as if the style is changing but neither...
8
61499
by: Udo Marx | last post by:
Hello to ciwas! Is there a way to change the bullet form, color, etc, of the element <li> under<ul> via css? Any reply will be appreciated. -- Freundliche Gruesse, Netzteil - Udo Marx http://www.netzteil.com mailto:marx@netzteil.com
7
6598
by: Frostillicus | last post by:
Hi, I've written some javascript to randomly choose a classical music composer's picture and sample audio and display it on my home page (http://marc.fearby.com/), and this works fine in Mozilla but has problems in IE. Here's the code: imagestring = "<img src=\"" + imagedir + composers + "\" />"; objimage.innerHTML = imagestring;
2
2513
by: Paolo Pignatelli | last post by:
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show) -- <gallery timer="3" order="sequential" fadetime="2" looping="yes" xpos="0" ypos="0"> <image path="images2/Test1.jpg" />
2
7526
by: reynardmh | last post by:
I tried to change the image.src on the fly when the user click a link. But for some reason it does not work in IE 6 (the image just disappear when I click the link), but if I add the alert('test') line on the change_pic function it works in IE. it's like IE just didn't refresh the display with the new image. Btw, the code works fine on Firefox 1.5.0.4 and Opera 8.52 Here is the simplified code: <script type="text/javascript">
0
1653
by: Steave | last post by:
Hi, using Managed C++ (.Net 2.0), I want to embed some images within an executable using a .resX file, and upon an event (in this case a combo box changing), I want the picture box to update with a different one. I tried the following code: System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(formDebayer::typeid));
1
3418
by: Chuck Anderson | last post by:
I'm using a simple, pseudo progress bar. Very simply, I display a still image next to a form submit button until the user clicks on it, and then I change the image source to an animated version of the still image. Like so (I use php a lot) ... -- the submit button and still image -- <input type=submit name="update _stats" value="Update Mailbox Stats" class="button"> <img id="loading" src="still_image.gif">
3
7358
by: bulldog8 | last post by:
I am having problems with changing a frames source file for Mozilla (1.5.0.4). The followig code works for IE: <script type="text/javascript"> var imgP = new Image(); function ShowPic(ShowThis, wdth, hght) { imgP.src = "../pics/' + ShowThis + '" xw = 500; yh = 500*(hght/wdth); window.document.getElementById("graphic").innerHTML = '<img src="../
9
9658
by: kombu67 | last post by:
I'm reading a series of images from a MS SQL table and saving them to directory. These are staff ID pictures from our security card app. Once I've extracted the ID photo from the security app to disk, I need to reference the disk file in our HR app. As part of the process, I'm resizing the image and changing its resolution from 96 to 72 dpi. If they are not at a 72 dpi resolution, the HR app freezes. The resizing works without a hitch, but...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.