Jump to content

Lepper

Members
  • Posts

    14
  • Joined

  • Last visited

Lepper's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. In the onclick event of the checkboxes (or in the onclick event of your button or submit button) you can call a javascript function that changes the href of the current page with the window.location.href = "http://the_page_you_want";An example is below:<script type="text/javascript">function goToPageDependingOnCheckedCheckBox(){ if(document.getElementById('check1').checked){ window.location.href = "/someDirectoryOfMyWebServer/page1.html"; } else { //if the checked checkbox is the other checkbox window.location.href = "/someDirectoryOfMyWebServer/page2.html"; }}</script> Note that a checkbox need validations and stuff (that i didn't did because i'm lazy ) so... better use a radio and you can delete the button, and call the function when the onclick event in that radio is called.Also you can see this page for a complete reference of DOM (very useful for javascript): http://www.w3schools.com/htmldom/default.aspGood learning!
  2. maybe this works:...onclick="window.open(window.location.href='var win = new Window({className: 'spread', title: 'Ruby on Rails',top:70, left:100, width:300, height:200,url: 'http://www.rubyonrails.org/', showEffectOptions: {duration:1.5}}); java script:win.show()')" style="cursor: pointer">... I'm not sure if this will work... but you can try :)Note: I think that there is a "}" that has no start "{"You must delete the last "}"
  3. it's absolutely necesary that all that "onclick" code be on the same line? I think that maybe is a quote problem (or that "java script" sentence maybe have to be "javascript")
  4. Hello!I need some help with detection of cookies. The problem regards to Internet Explorer. In mozilla I have no problem with the "navigator.cookiesEnabled", but in Internet Explorer always returns true, even if I deactivate in the the option "Tools -- Internet Options -- Privacy -- Advanced" checkboxes "Overwrite automatic cookies administration" and "Always accept session cookies".Maybe you don't understand me... but i need to detect if the browser can accept SESSION cookies from third parties... and the navigator.cookiesEnabled doesn't detect that. By default, internet explorer doesn't accept session cookies if the level of privacy is below of "block all cookies" (the top level of privacy).Sorry if I was "ununderstandable"... but my problem s getting me nuts!!Thank you everybody
  5. Sorry!! the correct way to access is document.forms[0].yourSelectBoxName.options[document.forms[0].yourSelectBoxName.selectedIndex].valueNote that "options" was added... I forgot to place it in my previos post... sorry.also... you can access a select element by the "document.getElementById(mySelectId)" function (if an id is defined for your select)please read this page with tutorials and properties of the select element
  6. I use the following but it doesn't work document.getElementById("myThing").style.background-color = "yellow"; However, this style property does work: document.getElementById("myThing").style.display = "block"; Am I accessing wrong the property background-color?Thanks!
  7. To access a value of a selected option in javascript you can use the following code in a javascript function that you define: //example that pop up a message with the value of the selected value in a select boxfunction alertSelectedValue(){alert(document.forms[0].yourSelectBoxName[document.forms[0].yourSelectBoxName.selectedIndex].value);} Hope this helps you in your algorythm
  8. The easiest way to open an image in a new window is to doing the following:<a href="/img/MyImage.jpg" target="_blank"><!-- the image to show... but littler--><img src="/img/MyImage.jpg" width="XX" height="XX"/></a ... yeah... this is not a javascript... but is the easiest way to open an image (called in this example "MyImage.jpg") in a new window (thanks to the "target="_blank"" atribute of the "a" tag).
  9. To show or hide some thing in your page use the property .style.display in the element you want to show/hide... for example: <script type="text/javascript">function showHide(id){var element = document.getElementById(id); try{ if(element.style.display == "none") {element.style.display = "";}} catch (e) { //do something if the id provided doesn-t obtain an element from your document}} PD: you can replace line <element.style.display = "";> with element.style.display = "block"; too
  10. THANK YOU VERY MUCH!!! Your answer was absolutely correct!! I thought that every getCodSomething() returns a String, but there was a method (.getCodEvaluacion()... the was not listed in your list ) that returns an int value... and there was the problem, because I used the method .equals in this primitive type! what a blasfemy!! Thank you very much jesh! I was confused because the error message that the compiler sends me, said that the problem was in "j" (the index of the "for" statement)... so... that teachs me that I cannot trust in the compiler messages :)Ah! this code is written in spanish... my country language :blink:Well... I repeat... THANK YOU VERY MUCH!! AAAH!!! I'M SO HAPPY!! THANK YOUUUU!!
  11. First of all... sorry for posting here... but there is no section of Java language in this forum... but i know someone here can help me :)I got the error "int cannot be dereferenced" inside a for... this is the code <% if(dsc != null) { boolean pintO = false; for(int j = 0; j < dsc.length; j++){if(dsc[j].getDetalleEvaluacion().getContenidoGlobal().getCodContenido().equals(detalleEvaluacion.getContenidoGlobal().getCodContenido())&& dsc[j].getDetalleEvaluacion().getContenidoGlobal().getUnidadGlobal().getCodUnidad().equals(detalleEvaluacion.getContenidoGlobal().getUnidadGlobal().getCodUnidad())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getAsignatura().getCursoColegio().getCodCursoColegio().equals(detalleEvaluacion.getEvaluacion().getAsignatura().getCursoColegio().getCodCursoColegio())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getAsignatura().getAsignatura().getCodAsignatura().equals(detalleEvaluacion.getEvaluacion().getAsignatura().getAsignatura().getCodAsignatura())&& dsc[j].getDetalleEvaluacion().getEvaluacion().getCodEvaluacion().equals(detalleEvaluacion.getEvaluacion().getCodEvaluacion())&& dsc[j].getCalificacion().getAlumno().getCodAlumno().equals(alumno.getCodAlumno())) {%><input type="text" onChange="soloNumeros(this);" title="Ingrese acá la puntuación obtenida en este contenido de la evaluación" class="input4" value="<%=dsc[j].getPuntajeContenidoCalificacion()%>"><% pintO = true; break; //si lo encontro se sale de la iteracion } } if(!pintO){%> <input type="text" onChange="soloNumeros(this);" title="Ingrese acá la puntuación obtenida en este contenido de la evaluación" class="input4"><%}}%> yeah... I know is a really large if... but there has to be that way :)the question is that this: I DON'T USE "j" like an object... because error "int cannot be dereferenced" appears when someone tries to use a primitive type like an object... "j" it's just an index to iterate over the array "dsc"... so... WHY IS THIS HAPPENING?Thanks to all... I know you can help me... please help me!!THANKS!!
  12. Lepper

    help!

    do you mean a different way of showing alerts boxes? (alerts like this? --> alert("My alert!")
  13. Lepper

    java

    A great site is w3Schools. It have a lot of information an tutorials :)Also you can find an incredible amount of examples an "ready codes" searching with google.If you have a more specific question about some thing, you can post here and we will try to help you as soon as possible
  14. How to access elements in AjaxAnywhere zones with DOM?Hello! I have a problem accesing the elements that is inside an AA (ajaxAnywhere) zone in my JSPs with the DOM thing. Also, the data that is contained in that elements it is not submited to the action, so... I had to make some big javascripts to send that data (slected item from a select box, words writen in a text box, etc) to the action making some "not sense" to use ajaxAnywhere. In example, if I want to access some property for a select box in the form of my JSP I use the following code: document.forms[0].selectBoxName.options[index].value but if that select box is inside an <aa:zone name="aaZoneName"> the previous code send me a javascript error saying me that "document.forms[0].selectBoxName" has no properties (doesn't exist). So... how can I access this element with DOM?? I have tried with "document.forms[0].aaZoneName.selectBoxName etc..." but the same error appears. And the other big problem is that the form beans inside aa:zone doesn't comunicate with the action (notice that I have defined a form properly with the same names etc... etc...) so I have to send all the information that I need in the action via URL... Am I doing something wrong? Am I a blasfemous being?I don't know in what DOM level the ajax zones lays... Thank you a lot for your help!
×
×
  • Create New...