balkan7 Posted July 4, 2008 Share Posted July 4, 2008 Hello guys, how can i convert my java script code to ajax ? code is: echo "<script language=\"javascript\" type=\"text/javascript\"> function banner_types(banner_c_id) { if (banner_c_id == 0) { banner_id_0.style.display = 'block'; banner_id_1.style.display = 'none'; banner_id_2.style.display = 'none'; banner_id_3.style.display = 'none'; } else if (banner_c_id == 1) { banner_id_0.style.display = 'none'; banner_id_1.style.display = 'block'; banner_id_2.style.display = 'none'; banner_id_3.style.display = 'none'; } else if (banner_c_id == 2) { banner_id_0.style.display = 'none'; banner_id_1.style.display = 'none'; banner_id_2.style.display = 'block'; banner_id_3.style.display = 'none'; } else if (banner_c_id == 3) { banner_id_0.style.display = 'none'; banner_id_1.style.display = 'none'; banner_id_2.style.display = 'none'; banner_id_3.style.display = 'block'; } } </script>"; echo "<table class='tbl-border' cellpadding='0' cellspacing='1' align='center' width='80%' >\n<tr> <td class='tbl2'><b>".$locale['M_020']."</b>: </td> <td class='tbl1'><select name='banner_type' class='textbox' style='width:120px' onchange=\"banner_types(this.options[this.selectedIndex].value);\"> <option value='0'>".$locale['M_021']."</option> <option value='1'".(isset($_POST['add_banner']) && $banner_type == 1 ? " selected='selected'" : "").">".$locale['M_022']."</option> <option value='2'".(isset($_POST['add_banner']) && $banner_type == 2 ? " selected='selected'" : "").">".$locale['M_023']."</option> <option value='3'".(isset($_POST['add_banner']) && $banner_type == 3 ? " selected='selected'" : "").">".$locale['M_024']."</option> </select></td></tr> <tr> <td class='tbl1' align='center' colspan='2'> <div id='banner_id_0' style='display: block'></div> <div id='banner_id_1' style='display: none'><input type='text' name='banner_img' style='width:200px;' class='textbox'><span class='small2'><br>".$locale['M_025']."</span></div> <div id='banner_id_2' style='display: none'><input type='file' name='banner_file_img' class='textbox' style='width:250px;'><span class='small2'><br>".$locale['M_026']."</span></div> <div id='banner_id_3' style='display: none'><input type='file' name='banner_file' class='textbox' style='width:250px;'><span class='small2'><br>".$locale['M_027']."</span></div> </td></tr>"; Quote Link to comment Share on other sites More sharing options...
haku Posted July 8, 2008 Share Posted July 8, 2008 Ajax IS javascript. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.