Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
I want to upload many files (.png , .pdf , etc) by using one input.
<input type="file" name="files[]" multiple />
This example captures the input result from an input tag that already contains multiple files
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
</head>
<body>
<input type="file" id="fileInput" multiple />
<script>
$(document).ready(function() {
$("#fileInput").change(function() {
var files = this.files;
for (var i = 0; i < files.length; i++) {
console.log("File " + (i+1) + ": " + files[i].name);
}
});
});
</script>
</body>
</html>
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 days ago.
Improve this question
the code doesnt function it loads up a blank screen
<!DOCTYPE html>
<html>
<head>
<title>Map Example</title>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>
</head>
<body>
<div id="map"></div>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 37.7749, lng: -122.4194},
zoom: 8
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"></script>
</body>
</html>
mostly changes to the code, the map just doesnt seem to load up
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I need to look at a file(json) from my html page. This file is on my onedrive and I published it to everybody who have the link. So ss there a way to look at a file from onedrive in my html site? If yes how?
Following the steps on https://msdn.microsoft.com/en-us/library/hh550848.aspx will allow you to accomplish this task.
On the HTML portion of your code, add the and to call the wl.upload function. Below is my code that will allow the use to select the file and upload it to a default folder on OneDrive. In this case, I used "me/skydrive/my_documents"
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Sample</title>
<script type="text/javascript" src="//js.live.net/v5.0/wl.js"></script>
</head>
<body>
<div style="padding: 1em">
<div id="signin"></div>
<label id="info"></label>
<form>
<input id="file" name="file" type="file" />
</form>
<button onclick="uploadFile()">Save file directly (calling WL.upload)</button>
<script>
WL.init({
client_id: 'Your_Client_ID',
redirect_uri: 'Your_Redirect_URL',
scope: "wl.signin",
response_type: "token"
});
WL.ui({
name: "signin",
element: "signin"
});
function uploadFile() {
WL.login({
scope: "wl.skydrive_update"
}).then(
function (response) {
WL.upload({
path: "me/skydrive/my_documents",
element: "file",
overwrite: "rename"
}).then(
function (response) {
document.getElementById("info").innerText =
"File uploaded.";
},
function (responseFailed) {
document.getElementById("info").innerText =
"Error uploading file: " + responseFailed.error.message;
}
);
},
function (responseFailed) {
document.getElementById("info").innerText =
"Error signing in: " + responseFailed.error.message;
}
);
}
</script>
</div>
</body>
</html>
The path "response.data.folders[0].id" is used to select the folder that the user has selected from the OneDrive file picker when WL.fileDialog is called. If you are uploading to a default folder, you would want to omit the file picker and use the JavaScript API.
Reference: https://support.microsoft.com/en-us/office/upload-files-and-folders-in-onedrive-work-or-school-5bd927ad-d186-495c-93e8-7ca116fe7b83
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to change all the occurrences of a word with another word using php. I want my HTML code to reflect the changes I have done accordingly.
<?php
$strhtml = '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>time</title>
</head>
<body>
<p id="post">Hello, How are you</p>
</body>
</html>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById('post');
$c = $elm->nodeValue;
$d= date("H");
if ($d<11)
str_replace("Hello","Good Morning",$c)
?>
You can use $dochtml->saveHTML() function to parse DOMDocument object to html content. This code works for me.
<?php
$strhtml = '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>time</title>
</head>
<body>
<p id="post">Hello, How are you</p>
</body>
</html>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById('post');
$c = $elm->nodeValue;
$d= date("H");
if ($d<11){
$c = str_replace("Hello","Good Morning",$c);
}
$dochtml->getElementById('post')->nodeValue = $c;
echo $dochtml->saveHTML();
?>
This question already has an answer here:
Rendering to JS with Jinja produces invalid number rather than string
(1 answer)
Closed 5 years ago.
in my index.html I can print these (keys,name,email)values
<body>
{{keys}}
{{Name}}
{{Email}
</body>
<component-app></component-app>
these from flask like this
return render_template("index.html",keys=my_keys,Name=my_name,Email=my_email)
I want to pass keys,name,email data to component-app, What should I do?
or can I pass data from flask to angular2's component??
The short answer: no, you can't. But you can create global js variables
<body>
<script type="text/javascript">
keys = '{{keys}}'
Name = '{{Name}}'
Email = '{{Email}'
</script>
</body>
Then in your component
public keys = window['keys']);
And in your angular html
{{ keys }}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have 2 HTML files , index.html that have 1 button , and process.html that have function Login() script... when i press the button, it redirect to process.html and process the function Login() automatically ... What must i do ? using a href or what?
index.html
<div class="login">
<div class="fb"><img src="facebook.JPG" style="cursor:pointer;" height="50px" width="250px"/><br></div>
</div>
process.html
<html>
function Login()
{
//code that process login
}
</html>
In index.html you put onclick="location.href='process.html'" at 'img' tag:
<div class="login">
<div class="fb">
<img onclick="location.href='process.html'" src="facebook.JPG" style="cursor:pointer;" height="50px" width="250px"/><br>
</div>
</div>
At process.html you put 'login();' function at the end of login code, you may use jquery document.ready function or body onload.:
<html>
<script>
function Login()
{
//code that process login
}
Login();
</script>
</html>