Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Javascript - Is there a shorter way of writing... ?

 
Logged in as: Guest
arrSession:exec spGetSession 2,7,62595
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Javascript - Is there a shorter way of writing... ?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Javascript - Is there a shorter way of writing... ? - 7/22/2008 3:17:06 AM   
  TKS


Posts: 187
Score: 0
Joined: 5/16/2008
Status: offline
window.event.srcElement.id=="idp" || window.event.srcElement.id=="idq" || window.event.srcElement.id=="idr" || window.event.srcElement.id=="ids"

Got any ideas?
 
 
Post #: 1
 
 RE: Javascript - Is there a shorter way of writing... ? - 7/27/2008 9:42:32 PM   
  mcnd

 

Posts: 23
Score: 0
Joined: 4/27/2008
Status: offline
Try this


      

half the size, but i have not tried the speed

(in reply to TKS)
 
 
Post #: 2
 
 RE: Javascript - Is there a shorter way of writing... ? - 8/2/2008 3:25:51 AM   
  TNO


Posts: 1284
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
window.event.srcElement.id === ("idp" ||"idq" || "idr" ||"ids")

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to mcnd)
 
 
Post #: 3
 
 RE: Javascript - Is there a shorter way of writing... ? - 8/2/2008 3:30:11 AM   
  TNO


Posts: 1284
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Here's another trick for you that may be useful:

document.getElementById(("something" || "somethingElse")).tagName

shortcut operators are nice

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to TNO)
 
 
Post #: 4
 
 RE: Javascript - Is there a shorter way of writing... ? - 8/21/2008 4:17:24 AM   
  TKS


Posts: 187
Score: 0
Joined: 5/16/2008
Status: offline
Makes the code so much faster. Thanks guys! 

(in reply to TNO)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Javascript - Is there a shorter way of writing... ? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts