Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

passing variable from inner window  RSS feed

 
Rajpreet Bajwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying out the inner windows [using DIV] with javascript for the first time.

On my main page, on click of a button I create a new inner window [ using a javascript function from http://scriptasylum.com]. Now while using this function, I supply html [6 argument to popUp] that should be displayed in the inner window. The html displays three text boxes and a save button. When the user presses the save button I want to invoke another javascript function with the values of the three text boxes. I am unable to see the values of the textboxes in my function.

Code for creating popUP
---------------------------
function1 createPopUp(){
new1 popUp(200, 100, 300, 175, ('popupID'+123), 'Name.<br><input name=\"name\" value=\"<c ut value="${report.Name}" />"\> Email.<br><input name=\"email\" value\"<c ut value="${report.Email}" />\"> UserId.<br> <input name=\"userId\" value="<c ut value="${report.User}" />" /> <button onklick=edit(name,email,userId);>Save</button>', "white", "gray", "8pt sans-serif", "Modify ", "lilac", "white", "#dddddd", "gray", "black", true, true, true, true, false);
}

Code which is invoked from the pop up
-------------------------------------
function1 edit(name, email, userId){
alert1("Hello"+$name+$email+$userId);
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I strongly suggest you edit your post to:

1) clean up the code of smilies
2) use UBB code tags
3) show the results after JSP processing
 
Rajpreet Bajwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajpreet Bajwa:
I am trying out the inner windows [using DIV] with javascript for the first time.

On my main page, on click of a button I create a new inner window [ using a javascript function from .]http://scriptasylum.com]. Now while using this function, I supply html [6 argument to popUp] that should be displayed in the inner window. The html displays three text boxes and a save button. When the user presses the save button I want to invoke another javascript function with the values of the three text boxes. I am unable to see the values of the textboxes in my function.

Code for creating popUP
---------------------------

Code which is invoked from the pop up
-------------------------------------

 
Rajpreet Bajwa
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies for posting without UBB tag, I couldn't find a way to alter my original post. However, I have added code tags in the reply.

Also, I think I found a way out for my problem. I am using form element in the inner html and using document.getElementsByName to get the values posted by the user. Somehow getElementById did not work.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajpreet Bajwa:
I couldn't find a way to alter my original post


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!