javascript - Need to change an image and text through functions with two parameters -
no clue doing wrong...i trying use function 2 parameters change image clicked on replace 'kendal' image in third row , change 'writing' text in fourth row different when different image clicked to....does see wrong??
</style> <script> function changes(newmessage, imagename) { var elementtoupdate = document.getelementbyid("writing") elementtoupdate.innerhtml = newmessage var tochange = document.getelementbyid("kendal") tochange.src = imagename } </script> </head> <body> <form name="tform" id="tform"> <table id="table" name="table" border="1"> <tbody id="tablebody" name="tablebody"> <tr id="firstrow" name="firstrow"> <th id="header1" name="header1" colspan="5">click on image enlarge</th> </tr> <tr id="secondrow" name="secondrow"> <td id="svu" name="svu"> <input type="image" src="svu-tnail.jpg" alt="law order svu" name="svupic" id="svupic" onclick="changes('svu.jpg, saint leo graduation 2016')"> </td> <td id="ocean" name="ocean"> <input type="image" src="ocean-tnail.jpg" alt="ocean" name="oceanpic" id="oceanpic" onclick="displaymessage('bachelors degrees in sport business , business management')" onclick="changeimage('oecan.jpg')"> </td> <td id="pizza" name="pizza"> <input type="image" src="pizza-tnail.jpg" alt="pizza" name="pizzapic" id="pizzapic" onclick="displaymessage('minor in hospitality')" onclick="changeimage('pizza.jpg')"> </td> <td id="sunflower" name="sunflower"> <input type="image" src="sunflower-tnail.jpg" alt="sunflower" name="sunflowerpic" id="sunflowerpic" onclick="displaymessage('taken after receiving diploma!')" onclick="changeimage('sunflower.jpg')"> </td> <td id="softball" name="softball"> <input type="image" src="softball-tnail.jpg" alt="softball" name="softballpic" id="softballpic" onclick="displaymessage('graduation on april 30, 2016 in saint leo, florida')" onclick="changeimage('softball.jpg')"> </td> </tr> <tr id="thirdrow" name="thirdrow"> <th id="kendal" name="kendal" colspan="5"> <input type="image" src="kendal.jpg" alt="kendal lefrancois" height="750px" width="750px" name="kendalpic" id="kendalpic"></th> </tr> <tr id="fourthrow" name="fourthrow"> <th id="writing" name="writing" colspan="5">kendal lefrancois</th> </tr> </tbody> </table> </form> </body> </html>
you missing couple of quotes. change this:
<td id="svu" name="svu"> <input type="image" src="svu-tnail.jpg" alt="law order svu" name="svupic" id="svupic" onclick="changes('svu.jpg, saint leo graduation 2016')"> </td>
to this:
<td id="svu" name="svu"> <input type="image" src="svu-tnail.jpg" alt="law order svu" name="svupic" id="svupic" onclick="changes('svu.jpg', 'saint leo graduation 2016')"> </td>
Comments
Post a Comment