Function showdiv (div_id, div_name, div_attribute_name) // ('comtent _ 000000', 'div ', 'comtent _ Div ')
{
VaR div_names = Document. getelementsbytagname (div_name );
// Alert (div_names.length );
For (VAR I = 0; I <div_names.length; I ++)
{
VaR name = div_names.item (I). getattribute ("name ");
// Alert (name );
// Alert (div_attribute_name );
// Alert (name = div_attribute_name );
If (name = div_attribute_name)
{
// Alert (name );
Div_names [I]. style. Display = "NONE"; // hide
}
}
Document. getelementbyid (div_id). style. Display = ""; // display
}
<Div align = "right"> <a href = "javascript: void (0);" onclick = 'javascript: showdiv ("comtent _ <Bean: write name = "dcembabycommentslist_list" property = "ID"/> "," Div "," comtent_div "); '> reply </a> | <a href =" javascript: void (0); "onclick =" javascript: deletefriend (<Bean: write name = "dcembabycommentslist_list" property = "ID"/> ); "> Delete </a> </div>
Http://www.cnblogs.com/zzn/archive/2005/01/07/87722.html
The Code is as follows. It can be saved as a JS file and imported from the page, or directly inserted into the page.
<SCRIPT defer>
VaR divs =
Document. getelementsbytagname('
Div');
VaR J = 0; // all advertisements are
DivSo you only need to block the first tag.
// To avoid mistaken removal, it is best to insert an empty pair before the entire file or the <body>
DivLabel.
Divs [J]. style. Display ="
None";
Pop211.close (); // name of the subwindow "pop211"
</SCRIPT>
Http://faq.csdn.net/read/81927.html
---------------------------
Microsoft Internet Explorer
---------------------------
The script cannot be operated across domains!
---------------------------
OK
---------------------------
Http://topic.csdn.net/t/20021002/18/1069591.html
<Div id = a name = AA> </div>
<Div id = B> </div>
<Div id = C name = CC> </div>
<Div id = D name = DD> </div>
<SCRIPT>
VaR EE = Document. getelementsbytagname ("Div ");
For (VAR I = 0; I <ee. length; I ++)
Alert ("Div" + I + "id =" + ee. item (I ). ID + "; name =" + ee. item (I ). getattribute ("name "));
</SCRIPT>
Note: Name is not a built-in property of Div.
Http://zhidao.baidu.com/question/90813706.html
Calculate the JS Code and replace the content of multiple Div with the same ID. reward points: 10-Question Time: Why is the problem disabled?
<Div id = "date"> </div>
<Div id = "date"> </div>
<Div id = "date"> </div>
<Div id = "date"> </div>
A piece of js code is required to display one content for all the above Divs.
The content is to display the current date.
Or other methods that can achieve this effect, thank you!
Question added:To replace several identical regions in batches, the content is displayed as the current date.
Any method that can be implemented is acceptable. You can find a solution ~ Thank you !! Questioner: wcm113-Four answers to the second-level questions of the first entry
The value of ID can only be unique. Therefore, two or more identical IDs cannot appear in a webpage. Use name instead.
<Div name = "date"> </div>
<Div name = "date"> </div>
<Div name = "date"> </div>
<Div name = "date"> </div>
<Script language = 'javascript '>
VaR mydate = new date ();
VaR localdate = mydate. tolocaledatestring (); // obtain the current date;
For (VAR I = 0; I <document. getelementsbynmae ('date'). length; I ++)
{
Document. getelementsbynmae ('date') [I]. innerhtml = localdate;
}
</SCRIPT> respondent: 570851835-Vice President, 11-Level 3-23
ID is the only one. Your div is called the date scheme responder: xlws2002-assistant level 2 3-26
<Script language = 'javascript '>
VaR mydate = new date ();
VaR localdate = mydate. tolocaledatestring (); // obtain the current date;
Document. getelementbyid ('date'). innerhtml = localdate;
</SCRIPT>
In addition, div is a unique identifier. I don't know if I can. The respondent is: 19yiduo86-assistant level 2 4-6.
I suggest you change all IDs to names so that you can modify them at a time.