Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > JavaScript and CSS

JavaScript and CSS Extensible Markup Language, Java Script, and CSS questions here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-26-2008, 08:55 PM
mamba_namba mamba_namba is offline
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0
mamba_namba is on a distinguished road
Default new to javascript, help with reducing redundancy

say i have these two functions:

Code:
function one(object)
object.style.right=1px;

function two(object) {
object.style.top=1px;
}

is there a way i could reduce redundancy by combining these two functions into one by adding an extra parameter? im thinking of something like this:

Code:
function three(object, direction) {
object.style.direction=1px;
}
how would i do something like this?

Last edited by Jordan; 04-28-2008 at 11:58 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-27-2008, 05:57 AM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 3,190
Last Blog:
The Windows Registry
Rep Power: 28
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: new to javascript, help with reducing redundancy

Hasn't this question just been posted?
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
new to javascript, help with reducing redundancy mamba_namba JavaScript and CSS 2 04-27-2008 05:55 AM
Nortan Popup Blocker + JavaScript Issue twalters84 JavaScript and CSS 3 03-11-2008 04:47 AM
PHP accessing through remotely javascript from another website deny Request Services (Paid) 4 01-28-2008 08:02 AM
[Easy as Pie] Unobtrusive JavaScript Kernel Programming News 0 12-20-2007 09:07 AM
Counting Files with JavaScript Matt JavaScript and CSS 5 08-01-2007 12:02 PM


All times are GMT -5. The time now is 02:01 AM.

Contest Stats

dargueta ........ 128.00000
John ........ 127.00000
Xav ........ 107.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads