To set the background color of the pull-down button to "gradient"

Asked 2 years ago, Updated 2 years ago, 103 views

The source code below is
in the selected song selection (stop) of the pull-down button. The background color is set to gradation.
"However, it is currently in a state other than ""Select (Stop)"" and pull down in that state
" When you open the button, the background color of the song selection (stop) is not gradation, but
It is the current background color (*Select and press
It's gradation...)
How do I rewrite the
of the song selection (stop) even when the pull-down button is open? Please let me know if the background color is gradation.

<bgsound id="bgm"src="loop="-1">

  <script type="text/javascript">
     <!--
       function selectBgm(e){
          var selectedIndex=e.selectedIndex;
              bgm.src=e [selectedIndex].value; 
              document.getElementById("bgmSelector").style.background=e[selectedIndex].style.background;
   }
     // -- >
  </script>


    <SELECT id="bgmSelector" style="background: linear-gradient(left, gold 0%, pink 35%, lime 100%);background: -webkit-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -moz-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -o-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -ms-linear-gradient(left, gold 0%, pink 35%, lime 100%);" onchange="selectBgm(this);">
      <OPTION style="background: linear-gradient(left, gold 0%, pink 35%, lime 100%);background: -webkit-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -moz-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -o-linear-gradient(left, gold 0%, pink 35%, lime 100%); background: -ms-linear-gradient(left, gold 0%, pink 35%, lime 100%);" value="" selected>選曲(停止)</OPTION>
      <OPTION style="background:green;"value="classic.wav">classic</OPTION>
      <OPTION style="background:deepink;"value="alarm.wav">alarm tone</OPTION>
    </SELECT>

javascript html css

2022-09-30 21:15

1 Answers

Unfortunately, there is no common way.

CSS support within the SELECT element pop-up menu varies across browser platforms.

  • Not supported by iOS/OSX Safari at all
  • Not supported by Google Chrome on Android/OSX
  • Other Google Chrome supports only monochromatic colors and cannot be graded

and so on.I remember Firefox, IE, and Edge were not fully supported.


2022-09-30 21:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.