473,898 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FF and JS not giving my image as default

785 Contributor
I'm trying to get a maze to default to always giving me the image as the marker and never give me the color as the marker. The code requires you to check a box to get the image marker to be used. So, I thought if I put played around with the checked box function, I'd get what I want, but I don't.

I tried changing this
Expand|Select|Wrap|Line Numbers
  1.   document.getElementById('markerImage').disabled = true;
to this
Expand|Select|Wrap|Line Numbers
  1.   document.getElementById('markerImage').disabled = false;
This is what else I did:
Expand|Select|Wrap|Line Numbers
  1.     if(hideEnd=='true') document.getElementById('hideEnd').checked = true;
  2.     if(markerImage=='true') document.getElementById('markerImage').checked = true;
  3.     if(markerImage=='true') document.getElementById('markerImage').checked = false;
This is the original code that gives green marker as default.
Expand|Select|Wrap|Line Numbers
  1. function cTheme() {
  2.   if(document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value!='none') {
  3.     startIcon = theme['startIcon'+document.getElementById('theme').selectedIndex];
  4.     endIcon = theme['endIcon'+document.getElementById('theme').selectedIndex];
  5.     document.getElementById('background').value = theme['background'+document.getElementById('theme').selectedIndex];
  6.     document.getElementById('borderColor').value = theme['borderColor'+document.getElementById('theme').selectedIndex];
  7.     document.getElementById('pathColor').value = theme['pathColor'+document.getElementById('theme').selectedIndex];
  8.     document.getElementById('markerColor').value = theme['markerColor'+document.getElementById('theme').selectedIndex];
  9.     document.getElementById('trailColor').value = theme['trailColor'+document.getElementById('theme').selectedIndex];
  10.     document.getElementById('backtrackColor').value = theme['backtrackColor'+document.getElementById('theme').selectedIndex];
  11.   } else {
  12.     startIcon = 'human.gif';
  13.     endIcon = 'home.gif';
  14.   }
  15.   document.getElementById('backgroundSpan').style.backgroundColor = document.getElementById('background').value;
  16.   document.getElementById('borderColorSpan').style.backgroundColor = document.getElementById('borderColor').value;
  17.   document.getElementById('pathColorSpan').style.backgroundColor = document.getElementById('pathColor').value;
  18.   document.getElementById('markerColorSpan').style.backgroundColor = document.getElementById('markerColor').value;
  19.   document.getElementById('trailColorSpan').style.backgroundColor = document.getElementById('trailColor').value;
  20.   document.getElementById('backtrackColorSpan').style.backgroundColor = document.getElementById('backtrackColor').value;
  21. }
  23. function cVersion() {
  24.   document.getElementById('length').disabled = false;
  25.   document.getElementById('bias').disabled = false;
  26.   document.getElementById('shape').disabled = false;
  27.   document.getElementById('border').disabled = false;
  28.   document.getElementById('braid').disabled = false;
  29.   document.getElementById('shape').disabled = false;
  30.   document.getElementById('randomStart').disabled = false;
  31.   document.getElementById('randomEnd').disabled = false;
  32.   document.getElementById('randomEndSeconds').disabled = false;
  33.   document.getElementById('hideEnd').disabled = false;
  34.   document.getElementById('print').disabled = false;
  35.   document.getElementById('background').disabled = false;
  36.   document.getElementById('borderColor').disabled = false;
  37.   document.getElementById('pathColor').disabled = false;
  38.   document.getElementById('markerColor').disabled = false;
  39.   document.getElementById('trailColor').disabled = false;
  40.   document.getElementById('backtrackColor').disabled = false;
  41.   document.getElementById('theme').disabled = false;
  42.   document.getElementById('markerImage').disabled = false;
  44.   if(document.getElementById('version').options[document.getElementById('version').selectedIndex].value==4) {
  45.     document.getElementById('length').disabled = true;
  46.     document.getElementById('bias').disabled = true;
  47.     document.getElementById('shape').disabled = true;
  48.   } else if(document.getElementById('version').options[document.getElementById('version').selectedIndex].value==5) {
  49.     document.getElementById('length').disabled = true;
  50.     document.getElementById('bias').disabled = true;
  51.     document.getElementById('shape').disabled = true;
  52.     document.getElementById('border').disabled = true;
  53.     document.getElementById('braid').disabled = true;
  54.     document.getElementById('shape').disabled = true;
  55.     document.getElementById('randomStart').disabled = true;
  56.     document.getElementById('randomEnd').disabled = true;
  57.     document.getElementById('randomEndSeconds').disabled = true;
  58.     document.getElementById('hideEnd').disabled = true;
  59.     document.getElementById('print').disabled = true;
  60.     document.getElementById('background').disabled = true;
  61.     document.getElementById('borderColor').disabled = true;
  62.     document.getElementById('pathColor').disabled = true;
  63.     document.getElementById('markerColor').disabled = true;
  64.     document.getElementById('trailColor').disabled = true;
  65.     document.getElementById('backtrackColor').disabled = true;
  66.     document.getElementById('theme').disabled = true;
  67.     document.getElementById('markerImage').disabled = true;
  68.   }
  69. }
  71. window.onload = function() {
  73.   mazesmithMain = document.createElement("DIV");
  74.   mazesmithMain.id = "mainSmithMain";
  75.   mazesmithMain.innerHTML = echo + echoBasic;
  76.   document.getElementById('mazesmith').appendChild(mazesmithMain);
  78.   eventHandle();
  79.   setKeys();
  80.   setKCode();
  82.   if(t!='') {
  83.     document.getElementById('rows').value = rows;
  84.     document.getElementById('cols').value = cols;
  85.     document.getElementById('path').value = path;
  86.     document.getElementById('length').value = length;
  87.     document.getElementById('border').value = border;
  88.     document.getElementById('braid').value = braid;
  89.     document.getElementById('bias').options[(bias)].selected = true;
  90.     document.getElementById('version').options[(version-1)].selected = true;
  91.     document.getElementById('background').value = background;
  92.     document.getElementById('borderColor').value = borderColor;
  93.     document.getElementById('pathColor').value = pathColor;
  94.     document.getElementById('markerColor').value = markerColor;
  95.     document.getElementById('trailColor').value = trailColor;
  96.     document.getElementById('backtrackColor').value = backtrackColor;
  97.     if(randomStart=='true') document.getElementById('randomStart').checked = true;
  98.     if(randomEnd=='true') document.getElementById('randomEnd').checked = true;
  99.     document.getElementById('randomEndSeconds').value = randomEndSeconds;
  100.     document.getElementById('shape').options[(shapeNo-1)].selected = true;
  101.     if(hideEnd=='true') document.getElementById('hideEnd').checked = true;
  102.     if(markerImage=='true') document.getElementById('markerImage').checked = true;
  104.     document.bgColor = background;
  105.     document.getElementById('title').style.color = borderColor;
  106.     document.getElementById('title2').style.color = borderColor;
  108.     cVersion();
  109.   }
  111.   document.getElementById('backgroundSpan').style.backgroundColor = document.getElementById('background').value;
  112.   document.getElementById('borderColorSpan').style.backgroundColor = document.getElementById('borderColor').value;
  113.   document.getElementById('pathColorSpan').style.backgroundColor = document.getElementById('pathColor').value;
  114.   document.getElementById('markerColorSpan').style.backgroundColor = document.getElementById('markerColor').value;
  115.   document.getElementById('trailColorSpan').style.backgroundColor = document.getElementById('trailColor').value;
  116.   document.getElementById('backtrackColorSpan').style.backgroundColor = document.getElementById('backtrackColor').value;
  118.   for(var a=0;a<=themes.length-1;a++) {
  119.     var optionName = new Option(themes[a], a, true, true);
  120.     document.getElementById('theme').options[document.getElementById('theme').length] = optionName;
  121.   }
  122.   var optionName = new Option('None', 'none', true, true);
  123.   document.getElementById('theme').options[document.getElementById('theme').length] = optionName;
  125.   if(t.length>22) { document.getElementById('theme').options[t[22]].selected = true; startIcon = theme['startIcon'+t[22]]; endIcon = theme['endIcon'+t[22]]; }
  127.   if(configPanel==1) document.getElementById(conType).style.display = 'block';
  128.   else createMainTable();
  129. }
This is the check box part of the code:
Expand|Select|Wrap|Line Numbers
  1.  <tr><td><span class="help" onclick="alert(\'Instead of using color markers, this option will use images.\')">(?)</span> Use images for markers</td><td style="text-align:right;"><input type="checkbox" id="markerImage" onfocus="focusObj = this.id;" /> \

Link to Full JS code

Link to Game

The other issue is that Firefox keeps giving me errors if I change the name of the js file and the link to the js file. Also, if I clear history, cookies, cache, etc., it refuses to give me the new gmaze.js file (which was why I was changing the name and link). It still gives me the original one with the original code. I'm about to quit using Firefox and try some other browser.

a long lost tpgames with my sister's old laptop as my died...
May 27 '09 #1
6 1959
9,735 Recognized Expert Moderator Expert
Hey tpgames, long time no see :)

I followed the link to the site but didn't see a check box.
This line is using a select element (not a check box):

Expand|Select|Wrap|Line Numbers
  1. function cTheme() {
  2.   if(document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value!='none') {
  3. //.....
  4. } else {
  5.     startIcon = 'human.gif';
  6.     endIcon = 'home.gif';
  7.   }
  8. //.....
  9. }
It seems to me that you want to set the "theme" select element's SelectedIndex to "none"..... in order to executed the Else block which sets the image.

Does that help at all?

The other issue is that Firefox keeps giving me errors if I change the name of the js file and the link to the js file. Also, if I clear history, cookies, cache, etc., it refuses to give me the new gmaze.js file (which was why I was changing the name and link). It still gives me the original one with the original code. I'm about to quit using Firefox and try some other browser.
What is the error?
Are you using FireBug?
May 27 '09 #2
785 Contributor
Hello Frinavale! It has been ages. :D

I'm seeing that the theme is set to none. The gmaze.js is exactly like what you posted. What am I seeing wrong? If I were to flip the theme code stuff and the else code stuff around, would it fix the problem, assuming I could get firefox to give me the NEW gmaze.js code and not the one in cache that it refuses to refresh?
Expand|Select|Wrap|Line Numbers
  1. # function cTheme() {
  2. #   if(document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value!='none') {
  3. # //.....
  4. # } else {
  5. #     startIcon = 'human.gif';
  6. #     endIcon = 'home.gif';
  7. #   }

The check box is found after you push "advance" and then look on the right side. I forgot to put in this bit of info. Sorry!

The Firefox browser error:
if I rename gmaze.js to z.js and change the link inside of errormaze.html to refer to z.js, firefox gives me a blank page. It never really clears the cache, history, etc. nor does it really reload the page. Thus, I could really never figure out what changes to the js code was working or not. Firefox kept insisting on giving me the original unchanged gmaze.js code no matter what I did. it refused to reload that gmaze.js file. So, do I have to reboot firefox everytime I change the js code and clear cache, etc in order to force firefox to read the js file anew?

(ps. My laptop died which is why I've not been here in ages! I now have my sister's old laptop, but don't know how long it will last.)
May 27 '09 #3
9,735 Recognized Expert Moderator Expert
Ok let's solve one problem at a time.
Let's get FireFox to load the right external JavaScript file first.

When I followed the link I noticed that in the JavaScript file loaded is named "gmaze.js"

Seeing that you're working with the JavaScript file named "z.js" you need to change the external JavaScript file being referenced.

Change your html to the following:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" Expires: Thur, 1 March 2007 13:00:00 GMT>
  2. <html>
  3. <head>
  4. <title> MAZES </title>
  5. <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
  6. <link type="text/css" rel="stylesheet" href="http://www.tpgames.net/gaming/2/puzzlers/mazes/adam.css"> 
  7. <link rel="shortcut icon" href="http://www.tpgames.net/tpgamesicon.gif">
  10. <style type="text/css">
  11.   body {
  12.     font-family: Arial,Sans;
  13.     font-size: 12px;
  14.   }
  15.   input,select {
  16.     font-size: 12px;
  17.   }
  18. </style>
  20. <script type="text/javascript" src="http://www.tpgames.net/gaming/2/puzzlers/mazes/adam/z.js"></script>
  23. </head>
  25. <body>
  29. <div id="mazesmith"></div>
  31. </body>
  32. </html>
Notice the <script> tag...make sure the URL is properly taking you to the "z.js" file (if it's not in the "gaming/2/puzzlers/mazes/adam" folder).
May 27 '09 #4
785 Contributor
I put function cTheme down to only
Expand|Select|Wrap|Line Numbers
  1.   {    startIcon = 'human.gif';
  2.   endIcon = 'home.gif';} 
and deleted everything else that came after the "IF" bit, but it didn't work, not even in IE. Which leads me to think that the issue is more complicated then a simple fix. The game worked but still gave me the default green. What I did didn't even break the code.

Now I'm really confused. Thanks!
May 27 '09 #5
785 Contributor
I renamed everything back to gmaze.js because firefox refused to recognize any other js file name. What I mean is that I am actually using gmaze.js as the file to change because when I change the name in the html file to a new link and name firefox doesn't read it.

However, do you want me to change the js file name to z.js to see if we can get Firefox to work properlly?
May 27 '09 #6
785 Contributor
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="http://www.tpgames.net/gaming/2/puzzlers/mazes/adam/z.js"></script>
This is the exact link I change errormaze.html too. I copied gmaze.js exactly as written into z.js. The result: blank page and no mazes. This is the same code that I accessed in IE that resulted in the game being seen. However, in IE, (which never saw the game before), accessed gmaze.js from errormaze.html.

When I did a search for "gmaze" inside the js codes, I didn't find anything. So, I couldn't find anywheres in the code that would dictate that the file must be named 'gmaze.js' in order for the game to show up.

And nothing in the other js file that the code does access can I find that dictates gmaze.js must be used as a name.
Expand|Select|Wrap|Line Numbers
  1. /* Mazesmith themes */
  3. var themes = new Array('Human','Red Sands','Grass Field', 'Blue', 'BW');
  5. var startIcon = 'human.gif';
  6. var endIcon = 'home.gif';
  8. var theme = new Array();
  10. /*
  11. Name:    Human IMAGE THEMED
  12. Author:    TPKyteroo 
  13. */
  15. theme['startIcon0']    = 'human.gif';
  16. theme['endIcon0']    = 'home.gif';
  17. theme['background0']    = 'bubbles.gif';
  18. theme['borderColor0']    = '#0000ff';
  19. theme['pathColor0']    = 'bubbles.gif';
  20. theme['markerColor0']    = 'human.gif';
  21. theme['trailColor0']    = '#purple';
  22. theme['backtrackColor0']= '#777777';
May 27 '09 #7

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

Similar topics

by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
by: abdullah1983 | last post by:
Hi Guys, I need some clarification regarding the problem with safari browser. Please find my code below. I'm setting the image src, mouseover and mouseout using javascript. The mouseover and mouseout are working perfect but only the source is not setting using java script. Please clarify me regarding this. PS: This problem is only for safari browser. <tr>
by: NASAdude | last post by:
I'm working on distributing a database using VS Tools for Office, and am having trouble with linked images on forms/reports. The image objects have a default path\file set on the .Picture property, which becomes invalid when the user installs the database (ie: c:\devpath\ becomes c:\program files\mydbapp, but the .Picture property still points to c:\devpath\) The problem is that I don't *know* what installation path the user will select,...
by: wkerplunk | last post by:
On mouseover it goes to the correct map say TheMap1.jpg and then on mouseOut it defaults back to map, I need to do a onClick that sets the TheMap1.jpg mouseOver to the default TheMap.jpg so the TheMap1.jpg is now the default image not the TheMap.jpg. So after I click for information, and mouseOut of that area TheMap1.jpg will stay as all the MouseOuts Until I click another area of the map say TheMap10.jpg once clicked TheMap10.jpg will become...
by: Eric | last post by:
Hi Everyone, I'm writing a UserControl that exposes a property of the type System.Drawing.Image, like this: Public Property DefaultImage() As Image Get Return propDefaultImage End Get Set(ByVal Value As Image)
by: Seth Illgard | last post by:
Hi, Im writting a custom CMS and everything looks great, except when I see the results in IE. What im trying to do is: *Have an image in a layer (or relative positioned, or just margined). The exact image's coordinates depends in the window size (Fluid design) *The image should display correctly in front(above) another image (header image)
by: googletired | last post by:
Hello, I haven't made a XSL in quite sometime so i am very rusty. Basicly i want the XSL to display a defined image if one is not present in the XML. here is my current XSL and XML will be below that, hope you can help. <?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" encoding="ISO-8859-1" omit-xml-declaration="yes"/>
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine when iam using a normal web page... but can't in content page.... Code in Master Page <%@ Master Language="C#" AutoEventWireup="true" CodeFile="submaster.master.cs" Inherits="submaster" %> <%@ Register Assembly="AjaxControlToolkit"...
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...
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...
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...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.