File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending parameters in js

 
swapnil paranjape
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am trying to send the parameters to the popup window from js function.
Now this is my js function and i am trying to send parameters to popup.

var newwindow = '';
function popitup(url,st,ed)
{
newwindow=window.open(url,'name','height=400,width=350');
var txt = st+'<br>'+ed
newwindow.document.body.innerHTML += txt;
}

this is the call to the function
popitup("\main.html","10","20");

This is javascript in my popup window(html) page here i want to display parameters....

var begin = ' ';
var end = ' ';
document.write(begin)
document.write("<br>")
document.write(end)
document.write("<br>")


but this is not working......
whats the problem?how should i send the parameters?i want to write that paramets in popup window...
 
swapnil paranjape
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got the solution for my above problem...now this is new question i want to ask......
i have this function
var newwindow = '';
function popitup(url,st,ed)
{

newwindow=window.open(url,'name','height=400,width=350');

var txt = st+'<br>'+ed

newwindow.document.getElementsByTagName('body')[0].innerHTML=txt;


}
AND THE CODE WRITTEN IN THE BODY IS

alert("Click OK ");
popitup("\trial.html","10","20");
alert("click ok alert2");
popitup("\trial.html","30","40");

now here 10 20 first gets displayed in popup window and then 30 40 gets diaplayed in popup window overwriting the 10 20
but i want to display both outputs in one window one below other...
how can i do this?
please help me.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to see if the window is open


Eric
 
swapnil paranjape
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using this code.....and checking weather the window is open or not and trying to append the o/p but still i am not getting o/p as expected....


this is my function

var newwindow = '';
function popitup(url,st,ed)
{
if (!newwindow.closed && newwindow.location)
{
newwindow.location.href = url;
}
else
{
newwindow=window.open(url,'name','height=400,width=400');
if (!newwindow.opener) newwindow.opener = self;
}

if (window.focus) {newwindow.focus()}

var txt st+'<br>'+ed
newwindow.document.getElementsByTagName('body')[0].innerHTML=txt;
}

still if i make consecutive function call like this ...

popitup(url,10,20)
popitup(url,30,40)

the output is :
first 10 20 gets displayed and then 30 40 is displayed in the same window overwriting 10 20.....i dont want that...i want 10 20 followed by 30 40.

how to do that?even i have made attempt to make txt global (var txt ='')...but that doent work...
please help me....
thank you

i would also like to know how to use "superimposed" div instead of a popup in this case...to display the o/p
[ July 26, 2005: Message edited by: swapnil paranjape ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look how you changed this line from your orginal and what I posted:

newwindow.document.getElementsByTagName('body')[0].innerHTML=txt;

Eric
 
swapnil paranjape
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you!!! i got the answer for the problem...+= was required rhater than = ...thank you....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic