www.webdeveloper.com
Results 1 to 2 of 2

Thread: Form reference

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    12

    Form reference

    hey all, im having an issue that maybe you could offer me a little advice on? i was thinking that the block of if statements that checks the range value in rightSph would be repeated for the other 3 and directed towards those to display the results. however, even without those three blocks, and what i have right now, entering any number into the other 3 forms results in the image "r39.gif." all four forms are active, despite the fact that i've only (or so i assumed) linked up one to the script thus far.

    thanks!


    Code:
    function showImg() {
    var rightSph = document.getElementById("rightSph").value;
    
    document.getElementById("image1").src = "blank.jpg"
    // go through ranges in form 1
    if (rightSph >= 3.25 && rightSph <= 4.75) {document.getElementById("image1").src = "poly.gif"}
    if (rightSph >= 5.00 && rightSph <= 6.50) {document.getElementById("image1").src = "167.gif"}
    if (rightSph >= 6.75 && rightSph <= 7.50) {document.getElementById("image1").src = "171.gif"}
    if (rightSph >= 7.75) {document.getElementById("image1").src = "174.gif"}
    if (rightSph >= -3 && rightSph <= 3) {document.getElementById("image1").src = "r39.gif"}
    if (rightSph <= -3.25 && rightSph >= -5) {document.getElementById("image1").src = "poly.gif"}
    if (rightSph <= -5.25 && rightSph >= -6.50) {document.getElementById("image1").src = "167.gif"}
    if (rightSph <= -6.75 && rightSph >= -7.25) {document.getElementById("image1").src = "171.gif"}
    if (rightSph <= -7.50) {document.getElementById("image1").src = "174.gif"}
    // go through ranges in right cyl
    
    }
    
    <form style="position:absolute; top:325px; left:700px;">
    
    <span class="rx">
        Form 1 <input type = "text" id = "rightSph" size = "7">
    	Form 2<input type="text" id="form2" size="07" />
    	x <input type="text" name="axis" size="3" />
    </form>
    
    <form style="position:relative; top:10px; left:00px;">
    <span class="rx">
        Form 3: <input type="text" name="form3" size="07" />
    	Form 4:<input type="text" name"form4" size="07" />
    	x <input type="text" name="axis" size="3" />
    </form>

  2. #2
    Join Date
    Jul 2007
    Posts
    386
    Two things:

    It seems that the example code provided is incomplete, since you clearly reference an image with id="miage1", but the HTML is not present.

    Also, in the example provided you have a error:
    HTML Code:
    Form 4:<input type="text" name"form4" size="07" />
    Missing a "=" sign there in the name of the input
    HTML Code:
    Form 4:<input type="text" name="form4" size="07" />

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles