Window.opener

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Window.opener

kvarnerexpress
worked on a simple window.opner() and it worked fine like this.

CODE

function popupwindow()
{
var window_open = window.open('childwindow.html','venderfindwindow','width=1000,height=700');
}
</script>
<form name="productCode">
<input type="text" name="Vender1" id="Vender1" width="45">
<input type="button" value="Find" onClick=popupwindow(); return false;")
</form>





CODE

<form name="vederlookup">
<input type="text" value="" name="Vender1" size="5"></td></tr>
<a href="javascript: doStuff('this');">close</a>
</form>
function doStuff(findItem){ window.opener.document.getElementById('Vender1').value=findItem;
window.close();
}



The above worked as expected. However, when I change the second file like this it does not close the window or communicate to the parent window. I wonder what am I doing wrong?


CODE

<form name="venderlookup">
<input name="searchtext" value=""><input type="submit" value="Search" onClick='goSearch()';>  
</form>
<script language="JavaScript">
function goSearch() {
document.write("hello world!");
document.write('<form name="form1">');    
document.write('<a href="javascript: doStuff("this");">close</a>');
document.write('</form>');
}




The last example does not close the window. Could you do like this" document.write('<a href="javascript: doStuff("this");">close</a>');"

Also, when I call my function goSearch() it takes removes the form from the screen and just shows the output of the function. Is it possible to continue to view the form without using frames?

Notice from snlildude87:
Use code BBCode tags

 

 

 


Reply

electriic ink
Because, of your use of " and '

<a href="javascript: doStuff("this");">

It should be:

<a href="javascript: doStuff('this');">

Your using the speech marks in the command 2 times so html will close the command when it sees the speech marks again. So it sees what your trying to do as this:

<a href="javascript: doStuff("this");">

The part in red is how it sees your link. The other part in blue it sees as stuff it doesn't need so it springs up a code error and doesn't work. Understand?

Right, now you want to write it in javascript and you want to use 3 types of speech marks for that but you only have 2 (' and ").

So you need to write it like this:

document.write("<a href=\"javascript: doStuff('this');\">");

I've added red marks where the key is the backslash. This is javascript 3rd speech mark only to be used inside document.write() and is the the answer to your worries!

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. exe file opener for mac - 10.88 hr back. (1)
  2. .exe opener mac - 24.99 hr back. (1)
  3. .exe opener for mac - 29.72 hr back. (1)
  4. javascript window.opener maximizing windows - 43.13 hr back. (1)
  5. parent window is opacity when child window open in javascript - 57.17 hr back. (1)
  6. create popup window but no access parent window till pop access in js - 58.56 hr back. (2)
  7. javascripts while opening child window the parent window should minimize - 58.68 hr back. (2)
  8. window.opener php - 75.78 hr back. (1)
  9. how to set window opener submit - 76.52 hr back. (1)
  10. "window.opener" toolbar browser - 80.89 hr back. (1)
  11. firefox default popup windows "window_open" size - 94.79 hr back. (1)
  12. exe opener for mac - 96.54 hr back. (1)
  13. webbrowser close parent window delphi - 103.98 hr back. (1)
  14. hta session opener window - 105.48 hr back. (1)
Similar Topics

Keywords : opener


    Looking for window, opener

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for window, opener

*MORE FROM TRAP17.COM*
advertisement



Window.opener



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE