FurkOk FurkOk - 1 year ago 72
HTML Question

How to print a html code using onclick() method via PHP?

I have this button:

<input type="submit" name="submit5" class="btn" value="Tarih ekle" onclick="tarih_alani_yap()" />

When i click it i want to add this code which is between tags. It doesnt matter how many click , if user wants to add 5 times it must be okay.

<? function tarih_alani_yap() {?>
<td class="left" valign="top">
<label>2.Talep Edilen Tarih Aralığı: <span class="required">*</span></label>
<td class="right">
<? if ($akis_kademe == "ekle") { ?>
<input class="text" type="text" size="11" name="rezerv_bas_tarih2" id="rbt"
onclick='scwNextAction=tarih_degisti.runsAfterSCW(this); scwShow(this,event);'
value="<?= (!empty($rez_bilgi['rezerv_bas_zaman'])) ? strftime("%d %b %Y", tarih_yap($rez_bilgi['rezerv_bas_zaman'])) : '' ?>" />

<input class="text" type="text" size="11" name="rezerv_bit_tarih2" id="rbt2"
onclick='scwNextAction=tarih_kontrol.runsAfterSCW(this); scwShow(this,event);'
value="<?= (!empty($rez_bilgi['rezerv_bit_zaman'])) ? strftime("%d %b %Y", tarih_yap($rez_bilgi['rezerv_bit_zaman'])) : '' ?>" />

<? } else echo strftime("%d %b %Y %H:%M", tarih_yap($rez_bilgi['rezerv_bas_zaman'], true)) . ' - ' . strftime("%d %b %Y %H:%M", tarih_yap($rez_bilgi['rezerv_bit_zaman'], true)) ?>


Answer Source

You can try the following jQuery function:

        $("div#divID").append("<div style='color:green'>Appended text</div>");

Hope it helps. =)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download