By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,090 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

javascript only runs one script???

mmect
P: 6
I have a website (www.taxxman.com/contacts.html) that contains javascript to round corners and adds a google map on the same page. The problem I'm having is that only the script for google maps works. On the other page, the rounding code works fine. I'm a newbie at javascript, so any help / advice you can give me will be much appreciated. Thanks!
Jan 7 '08 #1
Share this Question
Share on Google+
9 Replies


10K+
P: 13,264
I have a website (www.taxxman.com/contacts.html) that contains javascript to round corners and adds a google map on the same page. The problem I'm having is that only the script for google maps works. On the other page, the rounding code works fine. I'm a newbie at javascript, so any help / advice you can give me will be much appreciated. Thanks!
You will need to provide more details.
So you say you have two pages. On each of these pages only one script is working? What's the difference between these pages? Do your pages have all the values expected by both scripts?
Jan 7 '08 #2

Expert 100+
P: 785
I have a website (www.taxxman.com/contacts.html) that contains javascript to round corners and adds a google map on the same page. The problem I'm having is that only the script for google maps works. On the other page, the rounding code works fine. I'm a newbie at javascript, so any help / advice you can give me will be much appreciated. Thanks!
You are lucky that both that you want already works. You only need it to work together. This you can achieve easily with "morphing".
Morphing is the process in which you first append the source code of the second page at the end of the first page. Then you take away some unwanted source code parts that came form the second page, one by one, in a way that the code still works. I mean, if you delete some code and one of both desired functions stop working, then undo the changes an try with some other source code parts. At the end you have developed a page where both works.

I want to emphasize that this is a mechanical work, you don't need to understand the source code for it. But of course a little understanding helps much in doing it faster.
Jan 7 '08 #3

gits
Expert Mod 5K+
P: 5,333
hi ...

please post the source-code ... simply doing trial&error may get the thing to work ... but i guess that is not the solution for you. lets have a look at it together and you will get explainations why the code is not working and how you may fix it. understanding what you are doing is much better then those simple cut&paste-methods ...

kind regards
Jan 7 '08 #4

acoder
Expert Mod 15k+
P: 16,027
If you check the error console, you will see that map.addcontrol is not a function. It should be map.addControl (JavaScript is case-sensitive). This probably prevents the round corner script from working.
Jan 7 '08 #5

mmect
P: 6
Here's the script in the header...please let me know if you can help. I'm sure there's some consolidating of the code that I could do...just not sure where to start. Please not that I took out the Google Map Key.

Expand|Select|Wrap|Line Numbers
  1. <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<GOOGLE MAP KEY HERE>" type="text/javascript"></script>
  2.  
  3. <script type="text/javascript">
  4.     //<![CDATA[
  5.     function load() {
  6.       if (GBrowserIsCompatible()) {
  7.             var map = new GMap(document.getElementById("map"));
  8.             map.centerAndZoom(new GPoint(-93.025092, 44.984877), 7);
  9.  
  10.             // Miller Tax Service
  11.             var point = new GPoint(-93.025092, 44.984877);
  12.             var marker = new GMarker(point);
  13.             map.addOverlay(marker);
  14.  
  15.             //These are map controls.  You can add more by going to Google Maps - API
  16.             map.addControl(new GLargeMapControl());
  17.             map.addcontrol(new GMapTypeControl());
  18.       }
  19.     }
  20.     //]]>
  21. </script>
  22.  
  23. <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
  24. </script>
  25.  
  26. <script type="text/javascript">
  27. _uacct = "UA-2917358-1";
  28. urchinTracker();
  29. </script>
  30.  
  31. <script type="text/javascript" src="rounded_corners.js"></script>
  32.  
  33. <script type="text/javascript">
  34.  
  35.   window.onload = function()
  36.   {
  37.       /*
  38.       The new 'validTags' setting is optional and allows
  39.       you to specify other HTML elements that curvyCorners
  40.       can attempt to round.
  41.  
  42.       The value is comma separated list of html elements
  43.       in lowercase.
  44.  
  45.       validTags: ["div", "form"]
  46.  
  47.       The above example would enable curvyCorners on FORM elements.
  48.       */
  49.       settings = {
  50.           tl: { radius: 15 },
  51.           tr: { radius: 15 },
  52.           bl: { radius: 15 },
  53.           br: { radius: 15 },
  54.           antiAlias: true,
  55.           autoPad: true,
  56.           validTags: ["div"]
  57.       }
  58.  
  59.       /*
  60.       Usage:
  61.  
  62.       newCornersObj = new curvyCorners(settingsObj, classNameStr);
  63.       newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
  64.       */
  65.       var myBoxObject = new curvyCorners(settings, "myBox");
  66.       myBoxObject.applyCornersToAll();
  67.   } 
  68. </script>
  69.  
  70.  
If you go to taxxman.com/contacts, you'll see non-rounded corners...the rest of the site's pages has rounded corners, however...I think the code above is where the problem is.

Thank you all for your responses! I appreciate it.
Jan 8 '08 #6

acoder
Expert Mod 15k+
P: 16,027
The first problem is line 17 in your code. Compare it to line 16. The "c" in "map.addcontrol" needs to be a capital C. If you check the error console in any decent browser, e.g. Firefox, you would see this error flagged up.
Jan 8 '08 #7

mmect
P: 6
The first problem is line 17 in your code. Compare it to line 16. The "c" in "map.addcontrol" needs to be a capital C. If you check the error console in any decent browser, e.g. Firefox, you would see this error flagged up.
Thanks for spotting that...i fixed that code. The rounded corners are still not working, however. I can't figure out why. If you look at www.taxxman.com, you can see the rounded corners on the page...go back and forth between contact and home and you'll see the difference. I just can't pinpoint why this happens.
Jan 8 '08 #8

acoder
Expert Mod 15k+
P: 16,027
Thanks for spotting that...i fixed that code. The rounded corners are still not working, however. I can't figure out why. If you look at www.taxxman.com, you can see the rounded corners on the page...go back and forth between contact and home and you'll see the difference. I just can't pinpoint why this happens.
Are you sure you've fixed it? On the contacts page, the error still shows up.

You have a window.onload for the rounded corner script and body onload for the Google Map script. Either put the load() function into window.onload or the window.onload into load().
Jan 9 '08 #9

mmect
P: 6
Are you sure you've fixed it? On the contacts page, the error still shows up.

You have a window.onload for the rounded corner script and body onload for the Google Map script. Either put the load() function into window.onload or the window.onload into load().
I updated the Google map code...that works now. Yes, the rounded corner problem still exists. Thanks for the advice, i'll give that a shot and see if it works.

Thanks!
Jan 11 '08 #10

Post your reply

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