Jump to content

Javascript Solutions Helpp


Recommended Posts

Posted

[b]Javascript[/b]

1. Fill in the body of the sortByFoo function below. Executing the code should display true three times in your browser.

function sortByFoo(tab)
{
// TODO: Fill in the code here, using Array.sort.

return tab;
}

// Sort by .foo attribute
console.log(sortByFoo(
[{foo: 5}, {foo: 7}, {foo: 4}, {foo: 3}, {foo: 2}, {foo: 1}, {foo: 6}]
)[5].foo === 6);
// Does not crash on an empty array
console.log(sortByFoo([]).length === 0);
// For objects without a `foo` attribute, its value should be considered equal to '0'
console.log(sortByFoo([{foo: 42}, {bar: 7}, {foo: -5}])[1].bar === 7);

2. Finish the code below:

<html><head>
<script>
document.body.innerHTML = '
<div id="42" onclick="clicked(event)">1</div>
<div id="43" onclick="clicked(event)">2</div>
<div id="44" onclick="clicked(event)">3</div>';

function clicked(event)
{
// TODO: Fill in here. Use event.target.
// TODO: Display an alert containing the id of the clicked div
}
</script>
</head>
<body></body>
</html>

3. Rewrite the code above using DOM or jQuery calls instead of using innerHTML. If using jQuery, it will be considered accessible in the $ variable.



4. Write a jQuery module that provides the following methods for setting CSS border properties:

$('#foo').border('1px solid blue');
$('#foo').border({width: '2px', color: 'red', radius: '1px'});
$('#foo').border(null);
$('#foo').border(); // Returns the value of the border property


5. Code a slideUpAndOut(elem) javascript function that makes an element disappear by sliding upwards and out of the page, without altering the layout and positioning of other elements in the page.


repu aftrnun lopu submit cheyali ... helpp fleezz ... &*B@

Posted

java script weak

but good @ debugging/modifying in general

total HTML code pampu where u implemented this script i will try from my side

Posted

[quote name='cherlapalli_jailer' timestamp='1348592033' post='1302537379']
java script weak

but good @ debugging/modifying in general

total HTML code pampu where u implemented this script i will try from my side
[/quote]


hehe naku antha cinema ledu bhayya .. assignment adi .. neku telisina valaki PM cheye kasta .. eroju aftrnun lopu submit cheyali ...

Posted

devunike yenni kashtaalu vachinay...kalikaalam...[img]http://www.desigifs.com/sites/default/files/PK-1_1.gif?1344496355[/img]

Posted

[quote name='nenu_devudni' timestamp='1348597923' post='1302538003']
LTT
[/quote]
job , leka assignment? nenu try chesthaa antha topunithe kadhu JS loo adhi job ithee

Posted

[quote name='karna11' timestamp='1348600082' post='1302538290']
job , leka assignment? nenu try chesthaa antha topunithe kadhu JS loo adhi job ithee
[/quote]

bhayya anni cheyalsina avasaram ledu ... jus perfect ga okati chesi ichina chalu naku ....

×
×
  • Create New...