JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2013, 11:55 PM
Ihatephp Ihatephp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 53 Ihatephp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 3 m 27 sec
Reputation Power: 1
Can anyone tell what's the difference between these code, please?

I got these two code that were supposed to be identical to each other.

But one works fine but the other one doesn't and I don't know why..

I used "http://www.diffnow.com/" for comparison.
And it tells me number of differences are 0 between them.
Also, the looks identical to each other( I even looked through them for a couple of times).

However, I'm not actually confident that these two are exactly the same as each other since only one works fine while the other one doesn't as I said. I might have used the site in a wrong way and misunderstood what it said as a result.


Anyways, codes are these two.

First one (one that works fine):


Code:

<!DOCTYPE html>
<html>
<body>

<script>
function showCertainCategory(selection)
{
      var ulTag = document.getElementsByTagName('ul');

      for(var i=0; i<ulTag.length; i++)
  {
    ulTag[i].style.display = "none";
    if(ulTag[i].className == selection)
   {
     ulTag[i].style.display = "block";
   }
    else
   {
     ulTag[i].style.display = "none";
   }
  }
}

</script>
<form>
<select id="category" onChange="showCertainCategory(this.value)">
<option value="handle">handle</option>
<option value="wheel">wheel</option>
</select>
</form>

<ul class='handle'>
<li>Handle product A</li>
<li>handle</li>
</ul>
<ul class='wheel'>
<li>Wheel product B</li>
<li>wheel</li>
</ul>
<ul class='handle'>
<li>Handle product A2</li>
<li>handle</li>
</ul>
<ul class='wheel'>
<li>Wheel product B2</li>
<li>wheel</li>
</ul> 




</body>
</html>






================================================


Second one(One that doesn't work)

Code:

<!DOCTYPE html>
<html>
<body>



<script>
function showCertainCategory(selection)
{ 
  var ulTag = document.getElementsByTagName('ul');
              
  for(var i=0; i<ulTag.length; i++)
	{
	  ulTag[i].style.display = "none";
	  if(ulTag[i].className == selection)
	  {
	    ulTag[i].style.display = "block";
	  }
	   else
	  {
	    ulTag[i].style.display = "none";
	  }
	}
}
	
</script>
<form>
	<select id="category" onChange="showCertainCategory(this.value)">
		<option value="handle">handle</option>
		<option value="wheel">wheel</option>
	</select>
</form>

<ul class='handle'>
	<li>Handle product A</li>
	<li>handle</li>
</ul>
<ul class='wheel'>
	<li>Wheel product B</li>
	<li>wheel</li>
</ul>
<ul class='handle'>
	<li>Handle product A2</li>
	<li>handle</li>
</ul>
<ul class='wheel'>
	<li>Wheel product B2</li>
	<li>wheel</li>
</ul>




</body>

</html>






Reply With Quote
  #2  
Old February 19th, 2013, 12:40 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 40 m 59 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
There are some unusual characters after the "var ulTag" line. Check the attachment.

Simply delete the line.
Attached Images
File Type: png sidebyside.png (73.4 KB, 26 views)

Reply With Quote
  #3  
Old February 20th, 2013, 12:52 PM
Ihatephp Ihatephp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 53 Ihatephp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 3 m 27 sec
Reputation Power: 1
Thank you very much.

But how did you tell it?

and is having extra spaces between the lines so bad and why??



Quote:
Originally Posted by requinix
There are some unusual characters after the "var ulTag" line. Check the attachment.

Simply delete the line.

Reply With Quote
  #4  
Old February 20th, 2013, 01:15 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,676 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 1 h 40 m 59 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
I copy/pasted your code into Notepad so I could compare the two more easily. Notepad tends to show those squares for unusual/non-printable characters so they were hard to miss. So it was lucky, really.

It's not that the extra space is bad, it's what's present on that line. Deleting it makes the problematic characters go away; if you want the blank line then go ahead and add another one in.

Reply With Quote
  #5  
Old February 21st, 2013, 04:56 AM
Ihatephp Ihatephp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 53 Ihatephp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 3 m 27 sec
Reputation Power: 1
Well I used Notepad that comes with Windows and I couldn't see any of those problematic characters..

Did you set it to certain mode or something??



Quote:
Originally Posted by requinix
I copy/pasted your code into Notepad so I could compare the two more easily. Notepad tends to show those squares for unusual/non-printable characters so they were hard to miss. So it was lucky, really.

It's not that the extra space is bad, it's what's present on that line. Deleting it makes the problematic characters go away; if you want the blank line then go ahead and add another one in.

Reply With Quote
  #6  
Old February 21st, 2013, 12:05 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 599 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 40 m
Reputation Power: 69
The unusual characters requinix is referring to; and I am not sure how your missing it is:

In NotePad

Code:
              


They are right below the "ulTag" variable declaration. On this forum; they are represented as Ruby characters, but if you paste them into Notepad... they will look like small hollow squares. Delete these characters and the code will work fine. You can still keep the carriage return (to create a carriage return; all you have to do is press the "Enter" key, on your keyboard); just remove the characters.

Reply With Quote
  #7  
Old February 26th, 2013, 01:15 AM
efilnikufecin efilnikufecin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 56 efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level)efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level)efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level)efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level)efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level)efilnikufecin User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 4 h 11 m 54 sec
Reputation Power: 27
Some fonts will display nothing even in notepad for certain characters. Terminal is one of them. If you switch your font to Terminal in notepad you will quickly see how they could not see them.

Reply With Quote
  #8  
Old February 27th, 2013, 03:52 AM
Ihatephp Ihatephp is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 53 Ihatephp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 3 m 27 sec
Reputation Power: 1
well, I tried that font and other fonts too but it didn't work out that way.

I will just highlight everything so that I will find highlighted part that doesn't have any characters where it should be unusual characters.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Can anyone tell what's the difference between these code, please?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap