473,807 Members | 2,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mostrar ocultar etiquetas div desde un ID

Hola grupo tengo un codigo que como resultado me da un valor ejemplo
(p0, p1,......), que al visualizarlo por ejemplo parte del codigo es:

<script ....>
function valores(){
..... codigo.....
var _div = val[f].dato;
document.write( "<span id=.....>"+_div +"</span>");
}

lo que me visualiza p0 o p1 o etc....,

el resto del código funciona perfectamente ese no es el problema,
ahora
lo que quiero es como puedo tratar esta variable para pasarlo como el
ID de una etiqueta div, osea las etiquetas div ya estan asi:
<div id="p0"...>.... </div>
<div id="p1"...>.... </div>
<div id="p2"...>.... </div>..... etc.

funcion valores() funciona a partir de datos que el usuario ingresan
en un campo TEXT. y clickea buscar y se ejecuta.
la idea es que la funcion valores() encuentra un valor y quiero que se
muestre u oculte la DIV segun el valor encontrado,
osea que la div se muestre, y si se modifica la busqueda se oculte la
DIV y se muestre la DIV actual encontrada,
tengo este codigo para mostrar ocultar div:

<script ....>
var actual = "p0";

function tag(id){
return document.getEle mentById(id)
}

function muestra(capa){
tag(actual).sty le.display = "none";
actual = capa;
tag(actual).sty le.display = "block";
}
</script>

que de forma independiente funciona con esto:

<select onchange="muest ra(this.value)< option value="p1">capa 1<option
value="p2">capa 2...

ahi si oculta y visualiza

lo que no logro como hacer adaptarlo al codigo anterior para que
visualize los valores, sale error, a veces no ejecuta nada, como
hago!!!!!, ayuda!!!!!!.
les agradecere de antemano grupo, y que tengan un buen dia.

Los ideales son como las estrellas, no lograremos tocarlos; pero al
navegante en la inmensidad del océano le sirven de guía para llegar a
su destino.
Jun 27 '08 #1
1 8801
On Jun 19, 12:12 pm, LuisDavid <luisdavi...@gm ail.comwrote:
Hola grupo tengo un codigo que como resultado me da un valor ejemplo
(p0, p1,......), que al visualizarlo por ejemplo parte del codigo es:

<script ....>
function valores(){
..... codigo.....
var _div = val[f].dato;
document.write( "<span id=.....>"+_div +"</span>");

}

lo que me visualiza p0 o p1 o etc....,

el resto del código funciona perfectamente ese no es el problema,
ahora
lo que quiero es como puedo tratar esta variable para pasarlo como el
ID de una etiqueta div, osea las etiquetas div ya estan asi:
<div id="p0"...>.... </div>
<div id="p1"...>.... </div>
<div id="p2"...>.... </div>..... etc.

funcion valores() funciona a partir de datos que el usuario ingresan
en un campo TEXT. y clickea buscar y se ejecuta.
la idea es que la funcion valores() encuentra un valor y quiero que se
muestre u oculte la DIV segun el valor encontrado,
osea que la div se muestre, y si se modifica la busqueda se oculte la
DIV y se muestre la DIV actual encontrada,
tengo este codigo para mostrar ocultar div:

<script ....>
var actual = "p0";

function tag(id){
return document.getEle mentById(id)

}

function muestra(capa){
tag(actual).sty le.display = "none";
actual = capa;
tag(actual).sty le.display = "block";}

</script>

que de forma independiente funciona con esto:

<select onchange="muest ra(this.value)< option value="p1">capa 1<option
value="p2">capa 2...

ahi si oculta y visualiza

lo que no logro como hacer adaptarlo al codigo anterior para que
visualize los valores, sale error, a veces no ejecuta nada, como
hago!!!!!, ayuda!!!!!!.
les agradecere de antemano grupo, y que tengan un buen dia.

Los ideales son como las estrellas, no lograremos tocarlos; pero al
navegante en la inmensidad del océano le sirven de guía para llegar a
su destino.
No entiendo bien lo que quieres hacer...
aqui tienes lo que pienso preguntaste:

<div id="capas"></div>

<script>
var actual = "p0";

function tag(id){return document.getEle mentById(id)};

function valores()
{
..... codigo.....
// No te sugiero que te acostumbres a usar document.write por lo
tanto:
var _div = val[f].dato,
_a = document.create Element("div");
_a.innerHTML = _div;
tag("capas").ap pendChild(_a.fi rstChild);
};

function muestra(capa)
{
tag(actual).sty le.display = "none";
actual = capa;
tag(actual).sty le.display = "block";
};
</script>

<select onchange="muest ra(this.options[this.selectedIn dex].value);">
<option value="p1">capa 1</option>
<option value="p2">capa 2</option>
</select>

Fijate en el <select>, el que tu posteaste esta lleno de errores.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5372
by: Gema | last post by:
Hola a todos, tengo un formulario en el que solicito el nombre de una base de datos que luego quiero crear en SQL Server. Lo hago a traves del siguiente código: Private Sub btnCrear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCrear.Click Try Dim cnxCrear As New SqlClient.SqlConnection("Server = EPISTEME-SRV;" & _ "UID= sa; pwd= 123456; database= master")
0
1787
by: news.arsys.es | last post by:
Hola a todos. Me gustaria lanzar desde una macro comandos del tipo del asunto si es que se puede... Es para usarlo con las Autokeys.. Saludos a todos...
2
1865
by: Jorge Gallardo | last post by:
Hola a todos. Me gustaria saber si se puede utilizar lo del asunto desde una accion de macro... Si no es asi, como podria convertirlo a modulo para llamarlo desde la macro. Necesito que el campo "FECHARECIBOQSL" se me actualize a la fecha del dia. Alguna sugerencia... Gracias a todos
3
2069
by: David | last post by:
Hola, Estoy construyendo un keylogger que usa globalhook (con apis), el problema es que no todos los teclados son iguales, por ejemplo los de alfabetizacion española en lugar de ";" tienen la "ñ" y para acceder al ";" hay que presionar SHIFT + ",". Quiero capturar el caracter final que se tiene que mostrar, hay alguna forma de hacerlo? Alguna funcion API? Gracias
11
3607
by: Liber | last post by:
¿Alguien podría explicarme como enviar mails desde un WindowsForm ?, puedo hacerlo con un WebForm, pero no se como hacerlo con WindowsForm, podrían darme un ejemplo. Gracias, Saludos, Liber.
1
3561
by: moga | last post by:
Hola, Quisiera saber como ocultar una sección <div></divmientras la página se está cargando. Saludos, Jose Luis
1
3210
by: LuisDavid | last post by:
hola grupo, quisiera plantearles un problema que tengo, espero me puedan ayudar: tengo 10 etiquetas DIV cada una tiene un contenido de texto especifico, listas, etc. al cargar la pagina estan ocultas, lo que quiero es que se muestren cuando el usuario busca algo especifico de un menu SELECT incluso si ingresa un termino especifico en un campo TEXT y clickea BUSCAR, que se muestre la DIV donde se encuentra el termino ingresado que muestre...
0
10626
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.