473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

FF and JS not giving my image as default

tpgames
785 512MB
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 1921
Frinavale
9,735 Expert Mod 8TB
@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 512MB
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 Expert Mod 8TB
@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 512MB
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 512MB
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 512MB
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
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...
7
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...
6
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...
4
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,...
1
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...
9
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...
6
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...
6
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...
0
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...
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,...

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.