Jump to content

Lepper

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Lepper

  1. hiI need a help regarding how to load other jsp page on click of a button from current jsp page.My requirement is that I have a jsp page with two check boxes and a submit button. I need to load another jsp page on clicking the submit button depending opens select check box.I m new to jspAny help will be sppreciated.
    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. i have done this and now it displays the page in a box at the top of my page but it is embedded into the page not like a popup
    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. 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

  6. Hi folks,I have searched the forum but cannot find an exact fix to my problem probably because it is a too simple thing.This is my first foray into javascript after teaching myself HTML etc.All I want to do is use javascript to show a larger image of a product.I have an image on a page and I want the customer to click the image and a full size image appears in a new window.I appreciate that this will be an easy thing to do but I am lost with javascript.Thanks
    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).

  7. 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

  8. If any of those methods in your (amazingly large :blink:) if statement return an int rather than an object, it would most likely be the cause of your error. You might want to check those methods to see what the return types are.EDIT: I don't understand the language in which this is written, but these look like likely candidates for the cause of the error:.getCodUnidad().getCodAsignatura().getCodContenido().getCodAlumno()Only because I'm assuming "Cod Alumno" translates to something like "Alumni Code".
    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!! :)
  9. 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!!

  10. i want 2 learn java myself with online help do anybody know how i can learn it online. do anybody know any site which would be helpful to me in learning javascript.
    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 :)
  11. 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...