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

MariaDB under Linux starts with the root user (recommended)

Recently, due to the need to test security produc...

MySql 8.0.11 installation and configuration tutorial

Official website address: https://dev.mysql.com/d...

3D tunnel effect implemented by CSS3

The effect achievedImplementation Code html <d...

10 Tips to Improve Website Usability

Whether it is a corporate website, a personal blo...

How to lock a virtual console session on Linux

When you are working on a shared system, you prob...

How can MySQL effectively prevent database deletion and running away?

Table of contents Safe Mode Settings test 1. Upda...

A brief discussion on VUE uni-app template syntax

1.v-bind (abbreviation:) To use data variables de...

Problems encountered when updating the auto-increment primary key id in Mysql

Table of contents Why update the auto-increment i...

A friendly alternative to find in Linux (fd command)

The fd command provides a simple and straightforw...

The difference and execution method of select count() and select count(1)

Count(*) or Count(1) or Count([column]) are perha...

How to view and modify the time zone in MySQL

Today I found that a program inserted an incorrec...

Native JS to implement paging click control

This is an interview question, which requires the...