I have a CMS system and I made an option to manage the ads. Now what I have is a textbox where the paste their code, and I want to have a fast display of the ad so they can see the ad and if it's working. The problem is like here: problem to display dynamically a javascript google ad in an iframe using jquery (read the first answer).
I was wondering if it's somehow possible to do it or the only option is that they can only paste the code, but don't see it in action from the CMS itself.
EDIT I'm adding the code:
<div class="block" data="500" style="margin-top: 5px; height: 644px;">
<span class="brow" style="float: right;"><span class="label pla">תצוגה מקדימה:</span><div class="dprev"></div></span>
<span class="brow" style="float: left; margin-top: 0;"><span class="label">הקוד:</span><br />
<form action="pages/ad.php" target="preview1" method="post">
<textarea data="1" name="textbox" class="dcode" style="float: none; resize: none; width: 312px; height: 543px;">
<div style="width:160px;border:solid 1px #E5E5E5">
<INPUT id="merlin_q3" type="hidden" value="1">
<SCRIPT type=text/javascript>
function fnMerlinAddUrl(qStr,val) {
try{return('&' + qStr + '=' + val)}
catch(e){}
}
//params
merlin_partnerid = "3541";
merlin_search="q3";
merlin_search_result= '6';
merlin_start_offset= 0;
merlin_cols = '1';
merlin_lang="heb";
merlin_width ="90%";
merlin_url = "" ;
merlin_AdType="short_title_heb";
merlin_Iframe_Unique_Index="3";
merlin_default = "1";
merlin_decodeKeyword = escape(document.getElementById("merlin_q3").value);
var path='http://www.merlin.co.il/merlin_3rdparty/merlin_3rdparty.asp'; //&all=news
merlin_url=path+"?utf=0&fixed=marimedia&modaa=mo"+fnMerlinAddUrl("partnerid",merlin_partnerid);
merlin_url+=fnMerlinAddUrl("lang",merlin_lang);
merlin_url+=fnMerlinAddUrl("AdType",merlin_AdType);
merlin_url+=fnMerlinAddUrl("qtyResult",merlin_search_result);
merlin_url+=fnMerlinAddUrl("ScriptIndex",merlin_Iframe_Unique_Index);
merlin_url+=fnMerlinAddUrl("start_offset",merlin_start_offset);
merlin_url+=fnMerlinAddUrl("cols",merlin_cols);
merlin_url+=fnMerlinAddUrl("merlin_default",merlin_default);
merlin_url+='&q=' +merlin_decodeKeyword;
merlin_url+='&urlTag='+ "http%3A%2F%2Ftracking.merlin.co.il%2Faff_c%3Foffer_id%3D58%26aff_id%3D1216%26file_id%3D1652";
document.write("<table width=100%><tr><td valign=top id='Merlin_tdInsert3'></td></tr></table>");
var MerlinSS_OBJ=document.getElementsByTagName("HEAD");
if(!MerlinSS_OBJ)document.createElement('HEAD');
var oScript= document.createElement("script");
oScript.setAttribute("src",merlin_url);
document.getElementsByTagName("HEAD")[0].appendChild(oScript);
</SCRIPT>
</div><img src="http://tracking.merlin.co.il/aff_i?offer_id=58&aff_id=1216&file_id=1652" width="1" height="1">
</textarea>
</form></span>
<button style="position: absolute; margin-right: 330px; bottom: 14px;"><img src="img/v.png" style="margin-top: -2px; margin-left: 2px;" alt="add" height="28"/>שמור שינויים</button>
</div>
<h1 style="margin-top: -45px; position: relative;right: 574px;">פרסומת 2:</h1>
<div class="block" data="500" style="margin-right: 45px; height: 644px; margin-top: 5px;">
<span class="brow" style="float: right;"><span class="label pla">תצוגה מקדימה:</span><div class="dprev"></div></span>
<span class="brow" style="float: left; margin-top: 0;"><span class="label">הקוד:</span><br />
<form action="pages/ad.php" target="preview2" method="POST">
<textarea data="2" class="dcode" style="float: none; resize: none; width: 312px; height: 543px;">
<script type="text/javascript"><!--
google_ad_client = "pub-2151667935419035";
/* 120x600, created 7/17/08 */
google_ad_slot = "8233032726";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</textarea>
</form></span>
<button style="position: absolute; margin-right: 330px; bottom: 14px;"><img
src="img/v.png" style="margin-top: -2px; margin-left: 2px;" alt="add" height="28"/>שמור שינויים</button>
</div>
<script>
$("textarea.dcode").each(function (){
$(this).closest("div").children("span:first-child").children("div.dprev").html('<iframe class="adprev" name="preview'+$(this).attr("data")+'" src="pages/ad.php"></iframe>');
$(this).val($(this).text());
$('form[target="preview'+$(this).attr("data")+'"]').submit();
}).keyup(function (){
$(this).closest("div").children("span:first-child").children("div.dprev").html('<iframe class="adprev" name="preview'+$(this).attr("data")+'" src="pages/ad.php"></iframe>');
$('form[target="preview'+$(this).attr("data")+'"]').submit();
});
</script>
there is some other language there but that's not important, as you can see i have two iframes, but the code only works for the first. (first is merlin ads and second is google ads, but even i put the merlin in the second textbox it's not working).