3 ways to add links to HTML select tags

3 ways to add links to HTML select tags
The first one :

Copy code
The code is as follows:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>select add link</title>
</head>
<body>
<SCRIPT language=javascript>
<!--
// open the related site windows
function mbar(sobj) {
var docurl =sobj.options[sobj.selectedIndex].value;
if (docurl != "") {
open(docurl,'_blank');
sobj.selectedIndex=0;
sobj.blur();
}
}
//-->
</SCRIPT>
<Select onchange=mbar(this) name="select">
<OPTION selected>=== Partners===</OPTION>
<OPTION value="http://www.baidu.com">Baidu</OPTION>
<OPTION value="http://www.163.com">NetEase</OPTION>
<OPTION value="http://www.flash8.net/">Flash Bar</OPTION>
</Select>
</body>
</html>

Second type :

Copy code
The code is as follows:

<select name="pageselect" onchange="self.location.href=options[selectedIndex].value" >
<OPTION value="http://www.baidu.com">Baidu</OPTION>
<OPTION value="http://www.163.com">NetEase</OPTION>
</select>

The third one with jump button :

Copy code
The code is as follows:

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>select-button jump</title>
<script type="text/javascript">
function setsubmit()
{
if (mylink.value == 0)
window.location='http://www.baidu.com';
if (mylink.value == 1)
window.location='http://www.163.com';
if (mylink.value == 2)
window.location='http://www.sina.com';
}
</script>
</head>
<body>
<select name="mylink" id="mylink">
<OPTION value="0">Baidu</OPTION>
<OPTION value="1">NetEase</OPTION>
<OPTION value="2">Sina</OPTION>
</select>
<input type="button" id="btn" value="Submit" onclick="setsubmit(this)" />
</body>
</html>

<<:  css3 flex layout justify-content:space-between the last line is aligned to the left

>>:  Vue3 uses axios interceptor to print front-end logs

Recommend

The difference between datatime and timestamp in MySQL

There are three date types in MySQL: date(year-mo...

WeChat Mini Program Basic Tutorial: Use of Echart

Preface Let’s take a look at the final effect fir...

Implementation of fastdfs+nginx cluster construction

1. Introduction to fastdfs 1. What is fastdfs Fas...

How to start a transaction in MySQL

Preface This article mainly introduces how to sta...

MySQL slave library Seconds_Behind_Master delay summary

Table of contents MySQL slave library Seconds_Beh...

Introduction to possible problems after installing Tomcat

1. Tomcat service is not open Enter localhost:808...

Practical solution for Prometheus container deployment

environment Hostname IP address Serve Prometheus ...

Vue3.0 handwriting magnifying glass effect

The effect to be achieved is: fixed zoom in twice...

JavaScript timer to achieve seamless scrolling of pictures

This article shares the specific code of JavaScri...

Implementation of drawing audio waveform with wavesurfer.js

1. View the renderings Select forward: Select bac...

MySQL account password modification method (summary)

Preface: In the daily use of the database, it is ...

Summary of MySQL ALTER command knowledge points

When we need to change the table name or modify t...

Source code reveals why Vue2 this can directly obtain data and methods

Table of contents 1. Example: this can directly g...