473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FF and JS not giving my image as default

tpgames
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;
  4.  
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. }
  22.  
  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;
  43.  
  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. }
  70.  
  71. window.onload = function() {
  72.  
  73.   mazesmithMain = document.createElement("DIV");
  74.   mazesmithMain.id = "mainSmithMain";
  75.   mazesmithMain.innerHTML = echo + echoBasic;
  76.   document.getElementById('mazesmith').appendChild(mazesmithMain);
  77.  
  78.   eventHandle();
  79.   setKeys();
  80.   setKCode();
  81.  
  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;
  103.  
  104.     document.bgColor = background;
  105.     document.getElementById('title').style.color = borderColor;
  106.     document.getElementById('title2').style.color = borderColor;
  107.  
  108.     cVersion();
  109.   }
  110.  
  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;
  117.  
  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;
  124.  
  125.   if(t.length>22) { document.getElementById('theme').options[t[22]].selected = true; startIcon = theme['startIcon'+t[22]]; endIcon = theme['endIcon'+t[22]]; }
  126.  
  127.   if(configPanel==1) document.getElementById(conType).style.display = 'block';
  128.   else createMainTable();
  129. }
  130.  
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.
Thanks!

a long lost tpgames with my sister's old laptop as my died...
May 27 '09 #1
6 1934
Frinavale
9,735 Recognized Expert Moderator Expert
@tpgames
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
tpgames
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?

Thanks!
(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
Frinavale
9,735 Recognized Expert Moderator Expert
@tpgames
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">
  8.  
  9.  
  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>
  19.  
  20. <script type="text/javascript" src="http://www.tpgames.net/gaming/2/puzzlers/mazes/adam/z.js"></script>
  21.  
  22.  
  23. </head>
  24.  
  25. <body>
  26.  
  27.  
  28.  
  29. <div id="mazesmith"></div>
  30.  
  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
tpgames
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
tpgames
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
tpgames
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>
  2.  
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 */
  2.  
  3. var themes = new Array('Human','Red Sands','Grass Field', 'Blue', 'BW');
  4.  
  5. var startIcon = 'human.gif';
  6. var endIcon = 'home.gif';
  7.  
  8. var theme = new Array();
  9.  
  10. /*
  11. Name:    Human IMAGE THEMED
  12. Author:    TPKyteroo 
  13. */
  14.  
  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';
  23.  
  24.  
May 27 '09 #7

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

Similar topics

3
11747
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...
7
11608
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...
6
24179
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...
4
12824
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...
1
6301
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...
9
5039
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)
6
10518
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...
6
2222
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" ...
3
4407
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"...
0
7697
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...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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. ...
0
8120
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...
1
7672
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...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5512
isladogs
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
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...

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.