根据条件隐藏显示表 [英] hide display table based on condition

查看:52
本文介绍了根据条件隐藏显示表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我的项目要求显示两个表中的一个。这应该发生在页面加载。条件是基于地理位置。我能够根据地理位置(即IP)获取值,但我无法将该值传递给页面onload事件。

代码为:

<bodyönload=setTable(''); return false>



如果语法错误,请帮帮我。



提前致谢。

Hello,

I have a requirement in my project to display one of the table from two. This should happen at the page load. And the condition is based on geographical location.I am able to fetch value according to geographical location(i.e IP) but I am not able to pass that value to page onload event.
Code for it is:
<body önload="setTable('');return false">

Please help me out if my syntax incorrect.

Thanks in advance.

推荐答案

而不是在体载上调用原始javascript函数,使用JQuery javascript从www.jquery.com包含JQuery库。现在在load函数中执行你的东西,如下所示。



Instead of calling raw javascript function on body load,use JQuery javascript library to achieve this.Include JQuery library from www.jquery.com.Now perform your stuffs inside load function as below.

var location=Your_fetched_location;


window )。load( function (){
if location == A
{
(window).load(function(){ if(location== "A") {


(< span class =code-string> id_for_table_1)。show();
}
其他
{
("id_for_table_1").show(); } else {


这篇关于根据条件隐藏显示表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆