Javascript Onclick,不在任何android设备上工作

Javascript Onclick,不在任何android设备上工作,javascript,android,html,Javascript,Android,Html,我希望有人能帮助我,我有一个小麻烦与onclick标签。我所有的标签都可以在IOS设备上使用,但安卓系统不能。我从W3SSC学校获得了代码,以下是我的代码: <div class="col-md-6 next-slider"> <ul class="tab tab-content"> <li><a class="tablinks" onclick="openCity(event, 'RO

我希望有人能帮助我,我有一个小麻烦与onclick标签。我所有的标签都可以在IOS设备上使用,但安卓系统不能。我从W3SSC学校获得了代码,以下是我的代码:

<div class="col-md-6 next-slider">

               <ul class="tab tab-content">

                 <li><a class="tablinks" onclick="openCity(event, 'ROOMS')">ROOMS</a></li>
                 <li><a class="tablinks" onclick="openCity(event, 'MEALS')">MEALS</a></li>
                 <li><a class="tablinks" onclick="openCity(event, 'FACILITIES')">FACILITIES</a></li>
                 <li><a class="tablinks" onclick="openCity(event, 'VISITING')">VISITING</a></li>
                 <li><a class="tablinks" onclick="openCity(event, 'SOCIAL')">SOCIAL</a></li>
</ul>

<div id="ROOMS" class="tabcontent">
  <h3>ROOMS</h3>
  <p>All single bedrooms, most en-suite. All bedrooms are tastefully decorated and have a TV and nurse call bell. If residents wish they can bring some of their personal items and furniture.</p >
</div>

<div id="MEALS" class="tabcontent">
  <h3>MEALS</h3>
  <p>We offer a very extensive menu of home cooked meals including popular dishes such as hotpot, shepherds pie and fish &amp; chips every Friday.  Residents have a say when planning these and may take meals in their rooms when required.  Special diets are catered for.</p>
</div>

<div id="FACILITIES" class="tabcontent">
  <h3>FACILITIES</h3>
  <p>Each floor has its own large lounge and spacious dining room over-looking the Bay.  Bath/shower rooms situated on all floors, easy wheelchair access throughout the building. Ground floor is Residential Care and the first, second and third floors are Nursing Care.</p>
</div>

<div id="VISITING" class="tabcontent">
  <h3>VISITING</h3>
  <p>Relatives and friends are welcome at any time throughout the day. (We do ask that residents are not disturbed at mealtimes.) If you require any further details please do not hesitate to contact us.</p>
</div>

<div id="SOCIAL" class="tabcontent">
  <h3>SOCIAL</h3>
  <p>There are regular activities organised by our own Social Activities Organiser, Jacqui.  These include 
    Bingo, which is held twice a week and various other classes such as Painting, Music &amp; Movement, Crafts, Quizzes and Reminiscing of Past Times.</p>
  <p>An entertainer attends The Sands once a month, singing the residents' favourite songs.
    Pantomimes are held at Christmas time, and charity fund-raising events are held throughout the year, in which residents are welcome to get involved.</p>
  <p><strong>Monday</strong><br>
    Bingo
    1.30 pm     Keswick Suite Lounge </p>
  <p><strong>Tuesday</strong><br>
    Word Games
    10.15 am    Grasmere Suite Lounge <br>
    Music &amp; Movement
    1.30pm  Derwent Suite Lounge </p>
  <p><strong>Thursday</strong><br>
    Painting or Dominoes
    10.15 am    Keswick Suite Dining Room </p>
  <p><strong>Friday</strong><br>
    Reminiscence Group
    10.15 am    Keswick Suite Lounge<br>
    Bingo
    1.30 pm     Keswick Suite Lounge</p>
</div>

<script>
  $( function() {
    $( "#tabs" ).tabs();
  } );
</script>

  • 房间
  • 膳食
  • 设施
  • 拜访
  • 社会的
房间 所有单人间,多数为套房。所有的卧室都装饰得很雅致,有电视和护士呼叫铃。如果居民愿意,他们可以带一些个人物品和家具。

餐 我们提供非常丰富的家常菜菜单,包括火锅、牧羊人馅饼和鱼等流行菜肴;每周五吃薯条。居民在计划这些时有发言权,必要时可以在房间用餐。提供特殊饮食

设施 每层楼都有自己的大型休息室和宽敞的餐厅,可以俯瞰海湾。浴室/淋浴房位于所有楼层,方便轮椅进入整个建筑。一楼是住宿护理,一楼、二楼和三楼是护理

参观 一天中任何时候都欢迎亲朋好友。(我们要求居民在用餐时不要受到打扰。)如果您需要任何进一步的详细信息,请随时与我们联系

社会的 我们自己的社交活动组织者Jacqui定期组织活动。其中包括 宾果游戏,每周举行两次,以及各种其他课程,如绘画、音乐和音乐;运动、手工艺、测验和对过去的回忆

一位艺人每月去金沙一次,演唱当地居民最喜欢的歌曲。 圣诞期间会举行哑剧,全年都会举行慈善筹款活动,欢迎居民参与

周一
答对 了 下午1:30凯斯威克套房休息室

周二
文字游戏 上午10:15格拉斯米尔套房休息室
音乐及;移动 下午1:30德温特套房休息室

周四
绘画还是多米诺骨牌 上午10:15凯斯威克套房餐厅

周五
怀旧小组 上午10:15凯斯威克套房休息室
答对 了 下午1:30凯斯威克套房休息室

$(函数(){ $(“#制表符”).tabs(); } );
我不确定,但我有一个js文件:

// JavaScript Document

function openCity(evt, cityName) {
    // Declare all variables
    var i, tabcontent, tablinks;

    // Get all elements with class="tabcontent" and hide them
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }

    // Get all elements with class="tablinks" and remove the class "active"
    tablinks = document.getElementsByClassName("tablinks");
    for (i = 0; i < tablinks.length; i++) {
        tablinks[i].className = tablinks[i].className.replace(" active", "");
    }

    // Show the current tab, and add an "active" class to the link that opened the tab
    document.getElementById(cityName).style.display = "block";
    evt.currentTarget.className += " active";
}
//JavaScript文档
函数openCity(evt、cityName){
//声明所有变量
var i,tabcontent,tablinks;
//使用class=“tabcontent”获取所有元素并隐藏它们
tabcontent=document.getElementsByClassName(“tabcontent”);
对于(i=0;i
如果有人能帮助我,我将万分感激

亲切问候,


James

请尝试以下代码:

onclick="(function(){openCity(event, 'ROOMS');})()"

你传递的“事件”是什么
onclick=“openCity(event,'ROOMS')”
Android的哪个版本和Android上的哪个浏览器正在进行测试?我已经尝试过onclick=“(function(){openCity(event,'ROOMS');})(”),但遗憾的是它不起作用。它适用于所有平台,但不适用于android。我正在Android 6.0.1和谷歌Chrome以及Galaxy标签a上测试它。欢迎使用Stack Overflow!虽然这段代码可能会回答这个问题,但最好包含问题的描述,以及您的代码将如何处理给定的问题。对于将来,这里有一些关于堆栈溢出的信息。