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

Detailed explanation of MySQL/Java server support for emoji and problem solving

This article describes the support and problem so...

Explanation of MySQL index types Normal, Unique and Full Text

MySQL's index types include normal index, uni...

Database SQL statement optimization

Why optimize: With the launch of the actual proje...

MySql implements page query function

First of all, we need to make it clear why we use...

Sample code for implementing rolling updates of services using Docker Swarm

1. What is Docker Swarm? Docker Swarm is a cluste...

A brief analysis of MySQL's WriteSet parallel replication

【Historical Background】 I have been working as a ...

JS thoroughly understands GMT and UTC time zones

Table of contents Preface 1. GMT What is GMT Hist...

Detailed explanation of setting resource cache in nginx

I have always wanted to learn about caching. Afte...

Component design specifications for WeChat mini-program development

WeChat Mini Program Component Design Specificatio...

VMware Workstation 15 Pro Installation Guide (for Beginners)

01. VMware Workstation Pro 15 Download Download: ...

Docker network mode and configuration method

1. Docker Network Mode When docker run creates a ...

How to use MySQL DATEDIFF function to get the time interval between two dates

describe Returns the time interval between two da...

Let's talk in detail about the direction of slow SQL optimization in MySQL

Table of contents Preface SQL statement optimizat...