For all Javascript Coding Experts, can you break down this code?

This is a discussion on "For all Javascript Coding Experts, can you break down this code?" within the JavaScript Forum section. This forum, and the thread "For all Javascript Coding Experts, can you break down this code? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Dec 9th, 2007, 11:13
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
For all Javascript Coding Experts, can you break down this code?

Here is my question. I would like to add a weather section to my site but I want to customize this live weather feed so I could make it look like a part of my site (with a link to weather.com still of course)

HTML: Select all
<div id="wx_module_9429">
   <a href="http://www.weather.com/weather/local/92382">Running Springs Weather Forecast, CA (92382)</a>
</div>
 
<script type="text/javascript">
 
   /* Locations can be edited manually by updating 'wx_locID' below.  Please also update */
   /* the location name and link in the above div (wx_module) to reflect any changes made. */
   var wx_locID = '92382';
 
   /* If you are editing locations manually and are adding multiple modules to one page, each */
   /* module must have a unique div id.  Please append a unique # to the div above, as well */
   /* as the one referenced just below.  If you use the builder to create individual modules  */
   /* you will not need to edit these parameters. */
   var wx_targetDiv = 'wx_module_9429';
 
   /* Please do not change the configuration value [wx_config] manually - your module */
   /* will no longer function if you do.  If at any time you wish to modify this */
   /* configuration please use the graphical configuration tool found at */
   /* https://registration.weather.com/ursa/wow/step2 */
   var wx_config='SZ=300x250*WX=FHW*LNK=SSNL*UNT=F*BGI=winter*MAP=null|null*DN=rimnordic.com*TIER=0*PID=1053527172*MD5=ea755d53ba19a108ceb4fc74b920d6e2';
 
   document.write('<scr'+'ipt src="'+document.location.protocol+'//wow.weather.com/weather/wow/module/'+wx_locID+'?config='+wx_config+'&proto='+document.location.protocol+'&target='+wx_targetDiv+'"></scr'+'ipt>');  
</script>
That is the code itself, and here is what it should look like on a page, unedited.

http://wow.weather.com/weather/wow/b...943e09689fa94a

And I would like to make it look like the weather on this site:

http://www.bearmountain.com

I was thinking there would be a way to upload custom image files, and redirect the source to the new image files......somehow

Can this be done? Or would it be too difficult to accomplish?

thanks

Last edited by BlackReef; Dec 9th, 2007 at 11:15.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Dec 9th, 2007, 15:07
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: For all HTML Coding Experts, can you break down this code?

Someone move this to the JavaScript section.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Dec 9th, 2007, 15:30
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,794
Thanks: 0
Thanked 17 Times in 17 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Moved to Javascript section.
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Dec 9th, 2007, 16:28
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Try looking at the script located at:
http://wow.weather.com/weather/wow/module/92382...

That's the URL your code generates...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Dec 9th, 2007, 20:47
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Quote:
Originally Posted by swagner View Post
Try looking at the script located at:
http://wow.weather.com/weather/wow/module/92382...

That's the URL your code generates...
I don't think I understand quite what your saying? No script coding experience at all. I thought this would be an HTML problem, hehe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Dec 9th, 2007, 20:53
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Let me explain. The code you posted in your first post above "creates" a script. The source is a very long URL. When you go to that URL, you get this:
Code: Select all
function homeLink (locid){ window.location = 'http://wowweb.weather.com/weather/local/'+locid; } var intImage = 2; var tabs = new Array();tabs[tabs.length] = 'tab1';tabs[tabs.length] = 'tab2'; function selectTab(tab) {for( index = 0; index < tabs.length; index++ ) { var img = document.getElementById(tabs[index]); if( (index + 1) == tab ) { img.src = img.src.replace('Off', 'On'); } else { img.src = img.src.replace('On', 'Off'); } if(tab==1) { document.getElementById('tab4').style.border="#333333 solid"; document.getElementById('tab4').style.borderWidth="0px 0px 1px 0px"; document.getElementById('tab3').style.border="#CCCCCC solid"; document.getElementById('tab3').style.borderWidth="0px 0px 1px 0px"; if (document.getElementById) document.getElementById('maptab1').style.display = "block"; if (document.getElementById) document.getElementById('maptab2').style.display = "none"; } else if(tab==2) { document.getElementById('tab4').style.border="#CCCCCC solid"; document.getElementById('tab4').style.borderWidth="0px 0px 1px 0px"; document.getElementById('tab3').style.border="#333333 solid"; document.getElementById('tab3').style.borderWidth="0px 0px 1px 0px"; if (document.getElementById) document.getElementById('maptab2').style.display = "block"; if (document.getElementById) document.getElementById('maptab1').style.display = "none"; }}} function doSearch(){ var wh = document.getElementById('zipcode').value; window.open("http://wowweb.weather.com/search/enhanced?what=Weather36HourBusinessTravelerCommand&config=SZ=300x250*WX=FHW*LNK=SSNL*UNT=F*BGI=winter*MAP=null|null*DN=rimnordic.com*TIER=0*PID=1053527172*MD5=ea755d53ba19a108ceb4fc74b920d6e2&par=WOWs0_1053527172&site=300x250&cm_ven=WOWs0&cm_cat=300x250&code=link&promo=searchbox&cm_ite=link&cm_pla=searchbox&where="+wh, "wownewwin"); return false;} function hrefURL (url){ window.location = url; } if (document.getElementById && !document.getElementById('wx_wow_css') ) { var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = 'wx_wow_css'; link.rel = 'stylesheet'; link.type = 'text/css'; link.title = 'wow'; // replace the next line with conditional code based on protocol link.href = 'http://imawow.weather.com/web/common/header/stylesheet/wow.css'; head.appendChild(link); } function addEvent(objObject, strEventName, fnHandler) { if (objObject.addEventListener) objObject.addEventListener(strEventName, fnHandler, false); else if (objObject.attachEvent) objObject.attachEvent("on" + strEventName, fnHandler); } function initIE(divId, moduleHTML) { var newDiv = document.createElement('div'); newDiv.innerHTML = moduleHTML; var loadingDiv = newDiv.firstChild.cloneNode(false); loadingDiv.innerHTML = 'Loading...

';                  var targetDiv = document.getElementById(divId);         targetDiv.innerHTML = '';         targetDiv.appendChild(loadingDiv);                  addEvent(window, 'load',                 function() {  		targetDiv.className = "wow_container";                 targetDiv.innerHTML = newDiv.innerHTML;                }         );  }       function init(divId, moduleHTML) {        if (document.all) {                initIE(divId, moduleHTML)         } else { 	      document.getElementById(divId).className =  "wow_container";               document.getElementById(divId).innerHTML = moduleHTML;         }  } init('wx_module_9429',''+ '   '+ ''+ ' '+ '  '+ ' '+ ' '+ 'Your local forecast
available at weather.com'+ '
');
Now you can modify this code to achieve what you wanted...

If you need any help with modifying the script, just ask
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Dec 9th, 2007, 20:59
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

I am sorry for the confusion sir. Yes, I believe my goal is to modify the script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Dec 9th, 2007, 21:04
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Good. So, do you know how to modify it, or do you need help?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Dec 9th, 2007, 23:48
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

I believe I need help, yes. =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Dec 10th, 2007, 00:09
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

OK. What would you like to change?
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Dec 10th, 2007, 00:28
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

I basically want to set up the weather report so it looks customized for my web site. I don't want the "Weather Channel" white box. I basically want it to look like the weather report is part of the site.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Dec 10th, 2007, 01:00
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

Well, that's easy enough, but I need to know what your site looks like!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Dec 10th, 2007, 01:04
Up'n'Coming Member
Join Date: Jun 2007
Location: San Diego/RC
Age: 23
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: For all Javascript Coding Experts, can you break down this code?

RimNordic.com under Snow Report


and there is going to be a newer, updated one @ http://www.rimnordic.com/test/rimtest.php ("beta' is already up @ that link)

Last edited by BlackReef; Dec 10th, 2007 at 01:07.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript calculator help with coding Cat2008 JavaScript Forum 0 May 1st, 2008 14:48
BB Code - JavaScript Input thing... How? JasonStanley JavaScript Forum 5 May 5th, 2007 10:46
Help me,,Javascript coding toin JavaScript Forum 0 Apr 19th, 2007 04:14
Help required with javascript code trb1975 JavaScript Forum 1 Oct 20th, 2006 21:16


All times are GMT. The time now is 06:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42