Dentro del Master Page tengo una botonera con JavaScript, el problema que tengo es que cuando ejecuto el sitio web, no se me preciona la primera seccion, si no que queda precionada la seccion hasta que le de click, basicamente lo que necesito es que cuando se abra el index.aspx, quede precionado el boton de inicio sin tener que darle click.
HTML
Código:
CSS<div id="h-botonera"> <div id="boton1"> <div id="btn-inicio"> <a id="seccion1" onclick="javascript:redirect('../../index.aspx','seccion1');">Inicio</a></div> </div> <div id="boton2"> <div id="btn-nosotros"> <a id="seccion2" onclick="javascript:redirect('../es/nosotros.aspx','seccion2');">Nosotros</a></div> </div> <div id="boton3"> <div id="btn-servicios"> <a id="seccion3" onclick="javascript:redirect('../es/servicios.aspx','seccion3');">Servicios</a></div> </div> <div id="boton4"> <div id="btn-portafolio"> <a id="seccion4" onclick="javascript:redirect('../es/portafolio.aspx','seccion4');">Portafolio</a></div> </div> <div id="boton5"> <div id="btn-socios"> <a id="seccion5" onclick="javascript:redirect('../es/socios.aspx','seccion5');">Socios</a></div> </div> <div id="boton6"> <div id="btn-soporte"> <a id="seccion6" onclick="javascript:redirect('../es/soporte.aspx','seccion6');">Soporte</a></div> </div> <div id="boton7"> <div id="btn-contactenos"> <a id="seccion7" onclick="javascript:redirect('../es/contactenos.aspx','seccion7');">Contáctenos</a></div> </div> </div>
Código:
JavaScript#h-botonera { width: 930px; height: 49px; } #h-botonera #boton1 { width: 117px; height: 49px; float: left; } #h-botonera #boton1 #btn-inicio { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-inicio-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton1 #btn-inicio a { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-inicio.jpg'); background-repeat: no-repeat; display: block; text-indent: -99999px; cursor: pointer; } #h-botonera #boton1 #btn-inicio a:hover { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-inicio-over.jpg'); background-repeat: no-repeat; display: block; text-indent: -99999px; cursor: pointer; } #h-botonera #boton1 #btn-inicio a#linkSelect { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-inicio-over.jpg'); background-repeat: no-repeat; display: block; text-indent: -99999px; cursor: pointer; } #h-botonera #boton2 { width: 144px; height: 49px; float: left; } #h-botonera #boton2 #btn-nosotros { width: 144px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-nosotros-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton2 #btn-nosotros a { width: 144px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-nosotros.jpg'); background-repeat: no-repeat; text-indent: -99999px; display: block; cursor: pointer; } #h-botonera #boton2 #btn-nosotros a:hover { width: 144px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-nosotros-over.jpg'); background-repeat: no-repeat; text-indent: -99999px; display: block; cursor: pointer; } #h-botonera #boton2 #btn-nosotros a#linkSelect { width: 144px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-nosotros-over.jpg'); background-repeat: no-repeat; text-indent: -99999px; display: block; cursor: pointer; } #h-botonera #boton3 { width: 136px; height: 49px; float: left; } #h-botonera #boton3 #btn-servicios { width: 136px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-servicios-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton3 #btn-servicios a { width: 136px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-servicios.jpg'); background-repeat: no-repeat; cursor: pointer; display: block; text-indent: -99999px; } #h-botonera #boton3 #btn-servicios a:hover { width: 136px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-servicios-over.jpg'); background-repeat: no-repeat; cursor: pointer; display: block; text-indent: -99999px; } #h-botonera #boton3 #btn-servicios a#linkSelect { width: 136px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-servicios-over.jpg'); background-repeat: no-repeat; cursor: pointer; display: block; text-indent: -99999px; } #h-botonera #boton4 { width: 146px; height: 49px; float: left; } #h-botonera #boton4 #btn-portafolio { width: 146px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-portafolio-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton4 #btn-portafolio a { width: 146px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-portafolio.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton4 #btn-portafolio a:hover { width: 146px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-portafolio-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton4 #btn-portafolio a#linkSelect { width: 146px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-portafolio-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton5 { width: 108px; height: 49px; float: left; } #h-botonera #boton5 #btn-socios { width: 108px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-socios-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton5 #btn-socios a { width: 108px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-socios.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton5 #btn-socios a:hover { width: 108px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-socios-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton5 #btn-socios a#linkSelect { width: 108px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-socios-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton6 { width: 117px; height: 49px; float: left; } #h-botonera #boton6 #btn-soporte { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-soporte-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton6 #btn-soporte a { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-soporte.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton6 #btn-soporte a:hover { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-soporte-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton6 #btn-soporte a#linkSelect { width: 117px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-soporte-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton7 { width: 162px; height: 49px; float: left; } #h-botonera #boton7 #btn-contactenos { width: 162px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-contactenos-over.jpg'); background-repeat: no-repeat; } #h-botonera #boton7 #btn-contactenos a { width: 162px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-contactenos.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton7 #btn-contactenos a:hover { width: 162px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-contactenos-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; } #h-botonera #boton7 #btn-contactenos a#linkSelect { width: 162px; height: 49px; background-image: url('../../assets/es/images/manta-ray-studios-botonera-contactenos-over.jpg'); background-repeat: no-repeat; display: block; cursor: pointer; text-indent: -99999px; }
Código:
function selectCurrentPage(pageCCSID) { var selected = document.getElementById(pageCCSID); selected.setAttribute("id","linkSelect"); } function redirect(toURL, pageID){ var myForm = document.createElement("form"); myForm.method = "post"; myForm.action = toURL; var page = document.createElement("input"); page.setAttribute("name", "pageID"); page.setAttribute("value", pageID); myForm.appendChild(page); document.body.appendChild(myForm); myForm.submit(); document.body.removeChild(myForm); }