This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / One javascript question in an interview for a friend
-nicetomeetyou(淡定灌水);
2010-4-30
{541}
(#6044137@0)
-
没人提提答案?
-nicetomeetyou(淡定灌水);
2010-5-1
(#6045227@0)
-
Prototype JS $$(cssRule...) → [Element…]
-iron(iron man);
2010-5-1
{423}
(#6045647@0)
-
then assign all those DIVs with a class "100_20_" --- you give a very good advice, didn't think this way yet, thanks!
-nicetomeetyou(淡定灌水);
2010-5-1
(#6045710@0)
-
Once you know all those DIVs have class "100_20_", here's a very simple way to hide them all: $$('div.100_20_').invoke("hide");<html>
<head>
<script type="text/javascript" charset="utf-8" src="http://api.prototypejs.org/javascripts/prototype.js"></script>
</head>
<body>
<div id="100_20_1" class="100_20_">aaaaa</div>
<div id="100_20_234" class="100_20_">bbbbb</div>
<div id="100_20_44" class="100_20_">asfasfsa</div>
<script>
$$('div.100_20_').invoke("hide");
</script>
</body>
</html>
-iron(iron man);
2010-5-2
{397}
(#6046717@0)
-
谢谢,不过我还是用了div id, --> getdocumentbytagname() ---> for loop to check string in id using indexof().. 这个还是简单...但在hide/show时, IE正常, FF不正常, 唉..
-nicetomeetyou(淡定灌水);
2010-5-3
(#6048902@0)
-
一种可能性是用computed style.The IE Syntax:
var myObject = document.getElementById("header");
var myStyle = myObject.currentStyle.backgroundColor;
The Firefox Syntax:
var myObject = document.getElementById("header");
var myComputedStyle = document.defaultView.getComputedStyle(myObject, null);
var myStyle = myComputedStyle.backgroundColor;
-coolmao(酷猫*Zensunni);
2010-5-4
{329}
(#6048967@0)
-
you just showed us why it's a good idea to use a mature javascript library
-iron(iron man);
2010-5-4
(#6048997@0)
-
I tried it. The table on the page is a complex table, it has drag and drop, it has hide/show control, it shows the tree/branch/leaf structure. It works OK now on IE 8, but not IE 6, and not FF,The stuffs are hidden/shown successfully, but the whole table structure gets distorted....
-nicetomeetyou(淡定灌水);
2010-5-4
{90}
(#6049606@0)
-
看来你是能够得到id,只是不懂怎么hide。
-bdbs(不多不少);
2010-5-4
(#6049672@0)
-
I use style="display:none" or style="display:block" that should work in all browsers, right?.. what else? It works perfectly in IE. In FF, hide is ok, but when it shows again, the table doesn't show correctly..
-nicetomeetyou(淡定灌水);
2010-5-4
(#6049789@0)
-
看来你是真不知道。应该用style="display:none" 和 style="display:"
-bdbs(不多不少);
2010-5-4
(#6049799@0)
-
I tried that already, same result. The hide / show function works well in all browser types, except that in rows, if you don't hide them, every column is displayed, when you hide them and re-display them, some columns disappear..better show you example page here, but the website is blocked here...
-nicetomeetyou(淡定灌水);
2010-5-4
{69}
(#6049813@0)
-
你可以把code贴过来
-bdbs(不多不少);
2010-5-4
(#6049825@0)
-
This is the javascript code of the function
-nicetomeetyou(淡定灌水);
2010-5-4
{5170}
(#6049849@0)
-
This is the stylesheet for the XSLT transformation on server side to build HTML.
-nicetomeetyou(淡定灌水);
2010-5-4
{62950}
(#6049856@0)
-
拜托贴client side的code好不好?Javascript不是server side script。
-bdbs(不多不少);
2010-5-4
(#6049920@0)
-
Gosh, it is not allowed to submit whole codes, looks like there are some forbidden words in the code and Rolia blocks it...I give up.
-nicetomeetyou(淡定灌水);
2010-5-4
(#6050003@0)
-
I PM your the website by sending an image site.
-nicetomeetyou(淡定灌水);
2010-5-4
(#6050024@0)
-
I quickly double-checked: display: and display:block actually have the same result.
-nicetomeetyou(淡定灌水);
2010-5-4
(#6049826@0)
-
Is "display:" a CSS standard?
-liquid(豆泡松果 之 松果豆泡);
2010-5-4
(#6049883@0)
-
yes
-bdbs(不多不少);
2010-5-4
(#6049909@0)
-
Please let me know if you have received my PM, otherwise, I think of other way to send you the link.
-nicetomeetyou(淡定灌水);
2010-5-4
(#6050036@0)
-
不就是一个截图吗?干吗还要PM来PM去的。截图又没有source code,有什么用?
-bdbs(不多不少);
2010-5-4
(#6050247@0)
-
URL has been blocked by Rolia, I cannot paste it in post, so I send am image telling you the URL..
-nicetomeetyou(淡定灌水);
2010-5-4
(#6050309@0)
-
tried, got HTTP Status 404 - /Companypage/reg/editmenu
type Status report
message /Companypage/reg/editmenu
description The requested resource (/Companypage/reg/editmenu) is not available.
Apache Tomcat/6.0.18
-bdbs(不多不少);
2010-5-4
(#6050340@0)
-
I was just curious. The CSS2 standard for display property didn't say about empty string being a valid value.
-liquid(豆泡松果 之 松果豆泡);
2010-5-4
(#6050041@0)
-
那个不设就是空,设空就是RESET到缺省状态。
-bdbs(不多不少);
2010-5-4
(#6050248@0)
-
didn't you try my sample code above? it works with both ie and ff. isn't that the simplest solution you can ever use in this situation?
-iron(iron man);
2010-5-4
(#6048992@0)
-
问题条件不足,没说不能用 JQuery,一行就搞掂
-sowen(昂居居);
2010-5-4
(#6049177@0)
-
Exactly. How do you do it in jQuery?
-iron(iron man);
2010-5-4
(#6049245@0)
-
Google一下,Jquery Wild Card
-szs11(Hedge);
2010-5-4
(#6049806@0)
-
这种过份简单的问题,一看是牛哥提的,俺就懒得回答了。
-bdbs(不多不少);
2010-5-4
(#6049658@0)
-
兄弟,该给的我可都给了,眼巴巴的等着你帮助呢,是骆是马,水平低高,溜溜看啊,你不会撂下这句话就走了吧。。。。
-nicetomeetyou(淡定灌水);
2010-5-5
(#6051082@0)
-
你啥都没给呀。 (#6050340@0)
-bdbs(不多不少);
2010-5-5
(#6051114@0)
-
I posted the link in YTG, they don't block the link.
-nicetomeetyou(淡定灌水);
2010-5-5
(#6052454@0)
-
这是我想到的最简单高效又不需要任何工具的方法,很多时候最笨的方法就是最好的假设id的范围是100_20_1 到 100_20_1000, 可以简单的用一个循环搞定,
try { document.getElementById('100_20_' + i).style.display='none' } catch{ ... }
-yuanml(加拿大的家);
2010-5-4
{152}
(#6049867@0)
-
document.getElementsByTagName("div")var divs = document.getElementsByTagName("div");
for (var i = 0; i < divs.length; i ++){
if (divs[i].id.indexof('100_20_') >= 0){
//Hide div
divs[i].style.display = ‘none';
}
}
-billdxy(who's the next);
2010-5-4
{192}
(#6050263@0)
-
shake hand, that is exactly what I did.
-nicetomeetyou(淡定灌水);
2010-5-4
(#6050313@0)