Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks by Abhishek Shyam #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AbhishekShyam/Task-1/js/alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function altertPage()
{
alert('clicked');
}
34 changes: 34 additions & 0 deletions AbhishekShyam/Task-1/task-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<script>
let a=0;
function showContent()
{
console.log('shown')
document.getElementById("test").innerHTML += "Hello World! "+a+" times<br>";
a++;
}
</script>
<script type="text/javascript" src="./js/alert.js"></script>
</head>
<body>

<h1>Trying Features</h1>


<p id="test"></p>

<!-- internal script -->
<button onclick="showContent()">Show Text</button><br>

<!-- external script -->
<button onclick="altertPage()">Alert!</button><br>

<!-- inline script -->
<button onclick="print();">Print Content</button><br>

<script>
document.write('Hello from script');</script>
</body>
</html>
64 changes: 64 additions & 0 deletions AbhishekShyam/Task-2/task-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<script>
function toggleMe()
{
let visible = document.getElementById('test').style.visibility;
if(visible == 'hidden')
{
document.getElementById('test').style.visibility = 'visible';
}
else
{
document.getElementById('test').style.visibility = 'hidden';
}
}

function colorToggle()
{
let c = document.getElementById('test').style.color;

if(c=='red')
{
document.getElementById('test').style.color = 'blue';
}
else
{
document.getElementById('test').style.color='red';
}
}

function incFont()
{
document.getElementById('test').style.fontSize='xx-large';
}

function decFont()
{
document.getElementById('test').style.fontSize='medium';
}

function fill()
{
document.getElementById('fill').innerHTML+='Filled<br>';
}
</script>
</head>
<body>

<h1>Trying Features</h1>


<p id="test">HELLO WORLD</p>
<p id='fill'></p>
<button onclick="toggleMe()">Toggle Me</button>
<button onclick="colorToggle()">Color</button>

<button onclick="incFont()">Increase Font</button>
<button onclick="decFont()">Decrease Font</button>

<button onclick="fill()">Fill</button>

</body>
</html>
24 changes: 24 additions & 0 deletions AbhishekShyam/Task-3/mail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'Abhi@benne1234'
}
});

var mailOptions = {
from: mail,
to: pass,
subject: 'Sending Email using Node.js',
text: 'Cool'
};

transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
25 changes: 25 additions & 0 deletions AbhishekShyam/Task-3/uploadFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var http = require('http');
var formidable = require('formidable');
var fs = require('fs');

http.createServer(function (req, res) {
if (req.url == '/fileupload') {
var form = new formidable.IncomingForm();
form.parse(req, function (err, fields, files) {
var oldpath = files.filetoupload.filepath;
var newpath = 'C:\\Users\\Abhishek\\Desktop\\batch-1\\AbhishekShyam\\Task-3\\' + files.filetoupload.originalFilename;
fs.rename(oldpath, newpath, function (err) {
if (err) throw err;
res.write('File uploaded and moved!');
res.end();
});
});
} else {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<form action="fileupload" method="post" enctype="multipart/form-data">');
res.write('<input type="file" name="filetoupload"><br>');
res.write('<input type="submit">');
res.write('</form>');
return res.end();
}
}).listen(8080);