javascript - window.open does not work as expected, need some advice -


i'm new on javascript. have function not working expected. have input text (multiple, similar). added id each.

i used javascript function value, transfer them page processed. function script gone wrong, need solution, please help.

this script keeps open new tab. want open window, on frame named 'main'.

this function :

function addframe(fid){       var xfra= "x"+fid;       var nfr= document.getelementbyid(xfra).value;       var nwo= fid;       var link= "http://127.0.0.1/nims/index.php/jpbgr/frame/18?     xid=18&menu=new&order="+nwo+"&frame="+nfr;       var util= window.open(link);    }   

even if changed to:

var util= window.open(link, "main");

but still not working.

i used codeigniter.

thank you.

=======
index file:

<!doctype html> <html>   <head>     <title>ims-2017</title>   </head>   <frameset rows="0,*" frameborder=0 noresize>     <frame src="dummy.php" name="top" frameborder=0 noresize>     <frame src="./../nims/index.php/jpbgr/proses/18?xid=18&jid=cr" name="main">   </frameset> </html> 

this form inside body tag:

<form> <input type="text" placeholder="frame number" id="x1015909"> <button onclick="addframe('1015909');">go</button> </form> 

i want function sends text inputted other page, still in same window. first try use window.open() guess i'm wrong.

any idea how ?

thank you.

first of all, should using encodeuricomponent values make them safe pass. if want stay in same tab, try window.location.

for example,

function addframe(fid){     var xfra= encodeuricomponent("x"+fid);     var nfr= encodeuricomponent(document.getelementbyid(xfra).value);     var nwo= encodeuricomponent(fid);     var link= "http://127.0.0.1/nims/index.php/jpbgr/frame/18?xid=18menu=new&order="+nwo+"&frame="+nfr;     var util= window.location(link);    }   

the above stop running current page , open new page in tab code running in. if want populate iframe, should use contentwindow property of iframe instead of window code in. take @ this page more details on iframe.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -