/    Sign up×
Community /Pin to ProfileBookmark

Html and javascript. Please help!

Hi all,
I am new with web application. I want to input something and get to a link from input information like the following code. Please help me to solve this.
Thanks a lot.

“`
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>Untitled Page</title>
</head>
<body>

<h2> SEARCH </h2>
<form action=”/action_page.php” method=”post”>

<label for=”yymm”>Select time:</label>
<select name=”yymm” id=”yymm”>
<option value=”2107″>07/2021</option>
<option value=”2108″>08/2021</option>
<option value=”2109″>09/2021</option>
<option value=”2110″>10/2021</option>
<option value=”2111″>11/2021</option>
<option value=”2112″>12/2021</option>
<option value=”2201″>01/2022</option>
<option value=”2202″>02/2022</option>
<option value=”2201″>03/2022</option>
<option value=”2202″>04/2022</option>
<option value=”2203″>05/2022</option>
<option value=”2204″>06/2022</option>
<option value=”2205″>07/2022</option>
<option value=”2206″>08/2022</option>
<option value=”2207″>09/2022</option>
<option value=”2208″>10/2022</option>
<option value=”2209″>11/2022</option>
<option value=”2210″>12/2022</option>
</select>
<br>
Your ID: <Input Type = “TEXT” name = “MaKH” Value = “kk1” size = “4” maxlength = “6”>
<br>
Your code: <Input Type = “PASSWORD” name = “pass” Value = “1234” size = “4” maxlength = “6”>
<br>

<button onclick=”myFunction()” >Click to view!</button>
<br>
<p id=”linkCongno”>When click this will open the link: https://xxxx(domainname)/2107/kk1-1234.html (2107 = input time , kk1 = input ID, 1234 = input code)</p>

<script>
function myFunction() {

}
</script>
</form>
</body>
</html>
“`

//Please show me how to process in this function to call to the link above. Thank you

to post a comment
HTMLJavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERJul 27.2021 — Consider this.

You will need to add ID values to the user ID and password ID elements

You should also close your form with a </form> tag.

Code assumes the desired file exists (see line commented out after alert in your function)

``<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;!-- From: https://www.webdeveloper.com/d/395651-html-and-javascript-please-help --&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h2&gt; SEARCH &lt;/h2&gt;
&lt;form action="/action_page.php" method="post"&gt;

&lt;label for="yymm"&gt;Select time:&lt;/label&gt;
&lt;select name="yymm" id="yymm"&gt;
&lt;option value="2107"&gt;07/2021&lt;/option&gt;
&lt;option value="2108"&gt;08/2021&lt;/option&gt;
&lt;option value="2109"&gt;09/2021&lt;/option&gt;
&lt;option value="2110"&gt;10/2021&lt;/option&gt;
&lt;option value="2111"&gt;11/2021&lt;/option&gt;
&lt;option value="2112"&gt;12/2021&lt;/option&gt;
&lt;option value="2201"&gt;01/2022&lt;/option&gt;
&lt;option value="2202"&gt;02/2022&lt;/option&gt;
&lt;option value="2201"&gt;03/2022&lt;/option&gt;
&lt;option value="2202"&gt;04/2022&lt;/option&gt;
&lt;option value="2203"&gt;05/2022&lt;/option&gt;
&lt;option value="2204"&gt;06/2022&lt;/option&gt;
&lt;option value="2205"&gt;07/2022&lt;/option&gt;
&lt;option value="2206"&gt;08/2022&lt;/option&gt;
&lt;option value="2207"&gt;09/2022&lt;/option&gt;
&lt;option value="2208"&gt;10/2022&lt;/option&gt;
&lt;option value="2209"&gt;11/2022&lt;/option&gt;
&lt;option value="2210"&gt;12/2022&lt;/option&gt;
&lt;/select&gt;
&lt;br&gt;
Your ID: &lt;Input Type = "TEXT" name = "MaKH" Value = "kk1" size = "4" maxlength = "6" id="myID"&gt;
&lt;br&gt;
Your code: &lt;Input Type = "PASSWORD" name = "pass" Value = "1234" size = "4" maxlength = "6" id="pswd"&gt;
&lt;br&gt;

&lt;button onclick="myFunction()" &gt;Click to view!&lt;/button&gt;
&lt;br&gt;
&lt;p id="linkCongno"&gt;When click this will open the link: https://xxxx(domainname)/2107/kk1-1234.html (2107 = input time , kk1 = input ID, 1234 = input code)&lt;/p&gt;
&lt;/form&gt;

&lt;script&gt;
function myFunction() {
const yymm = document.getElementById('yymm').value,
myID = document.getElementById('myID').value,
pswd = document.getElementById('pswd').value;
const str =
https://xxxx(domainename)/${yymm}/${myID}-${pswd}.html;

alert(str); // for testing purposes only
// document.window.open(str); // will open window if exists -- see: https://www.w3schools.com/jsref/met_win_open.asp
}
&lt;/script&gt;

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;<i>
</i>
``
Copy linkTweet thisAlerts:
@SempervivumJul 27.2021 — @hosting20212021#1634729 Please use code tags: `your code here` or triple backticks when posting code. I edited your posting accordingly.
Copy linkTweet thisAlerts:
@JMRKERJul 28.2021 — @Sempervivum#1634766

Thanks for the correction, I thought I had entered correctly, but I guess not.
×

Success!

Help @hosting20212021 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...