User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 374,027 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,897 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1431 | Replies: 3
Reply
Join Date: May 2007
Posts: 23
Reputation: thirunavukaras is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
thirunavukaras thirunavukaras is offline Offline
Newbie Poster

I have a link wich opens a the second page with links wich call a javascript functio

  #1  
Jul 13th, 2007
I have a link wich opens a the second page with links wich call a javascript function.

I have some problem with javascript.


i am two aspx page..

in my first aspx page contain the second aspx page name..

i am clicking the second page link the second page is opened..

but

i wrote the javascript finction in second page..

in this the function does not execute..

how to solve the problem.......

please help me..

first Page name.......form1

second page name....form2

form1.aspx

<input type="text" name="stationFrom" size="16" value="" onblur="return openStationFrom();" >

function openStationFrom()
{


window.open("../enquiry/form2.aspx?" & mstrSession & "&stnName="+escape(document.form1.stationFrom.value)+"&formName=Form1&fieldName=stationFrom&leftWidth=0","","dependent=yes,width=350,height=375,screenX=200,screenY=300,titlebar=no,scrollbars=auto,maximize=no");
}

form2.aspx

<input type="hidden" name="formName" value='Form1'>


<input type="hidden" name="fieldName" value='stationFrom'>

<select name="stationNameCode" size=5 >

<option value='voter id(vt)'</option>

<option value='passport(PO)"option>

</select>
<input type="button" value="GO" onclick=" return setStationField()">

function setStationField()
{
if(document.form2.stationNameCode.selectedIndex<0)
{
alert("Please Select The Station From The List");
return false;
}

formName = document.form2.formName.value;
fieldName = document.form2.fieldName.value;
window.opener.document.forms[formName][fieldName].value = document.form2.stationNameCode[document.form2.stationNameCode.selectedIndex].value;
window.close();
}

this is my used source code..

my problem is..

i am click form2.aspx in GO button ..

i want to click the go button the form2 stationNameCode.selected index value go to form1.aspx to stationFrom text box..

i want to pass form2.selected index to form1.aspx

please help me.. how to do....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,731
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 323
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: I have a link wich opens a the second page with links wich call a javascript functio

  #2  
Jul 14th, 2007
You can access the parent window or the window which opened the new window using the global reference 'opener'.

Keep one hidden field each for the data which you want to pass from the new page to the original page and using the reference of the original page (opener), manipulate the fields of the parent window.

Something like this:
  1. <!-- Parent (ee.html) -->
  2. <html>
  3. <head>
  4. <script>
  5. function go()
  6. {
  7. window.open("dd.html");
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <form name="frm">
  13. <input type="text" value="Hello" id="txt" name="txt" />
  14. <input type="button" name="btn" id="btn" value="Button" onclick="go();" />
  15. </form>
  16. </body>
  17. </html>

  1. <!-- Child (dd.html) -->
  2. <html>
  3. <head>
  4. <script>
  5. function go()
  6. {
  7. alert(opener.document.frm.txt.value);
  8. }
  9. function change()
  10. {
  11. opener.document.frm.txt.value = "This is changed text";
  12. this.close();
  13. opener.focus();
  14. }
  15. </script>
  16. </head>
  17. <body onload="go();">
  18. <form>
  19. <input type="button" value="Change Value in Parent" id="btn" name="btn" onclick="change();"/>
  20. </form>
  21. </body>
  22. </html>
Last edited by ~s.o.s~ : Jul 14th, 2007 at 3:26 pm.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: May 2007
Posts: 23
Reputation: thirunavukaras is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
thirunavukaras thirunavukaras is offline Offline
Newbie Poster

Re: I have a link wich opens a the second page with links wich call a javascript functio

  #3  
Jul 18th, 2007
Thnaks s.o.s~..

thanks for your kind reply....

I am working this code...working properly...

but the issue is i am not change the javascript code in second code..

because the second page is ".html" page ....

the second page javascript does not change..

i am sorry already i have not informed...

but i am not modified second page everything

please how to do..

please help me......

so in my first page i click the one lint the second page window.open() is open..

so i am not chage the seocond page..

please reply...
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,731
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 323
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: I have a link wich opens a the second page with links wich call a javascript functio

  #4  
Jul 18th, 2007
You have to change the Javascript code in the second page otherwise your purpose won't be achieved. Why can't you change the code in the second page?
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 11:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC