That's the way things are.
This afternoon I was brushing the joy of the shell brush, suddenly demand came down.
It! On This! You! Under To! The
Customers say we need to open a new window to make a fuzzy query, and then select a query result to backfill into the parent window.
Valy easy.
Then I found the Fuzzy query page called agentsearch.jsp.
That's what's inside.
function Backfill () {var val = document.getElementById ("Agentsearch"). Value; var parwin = window.dialogarguments; ParWin.document.getElementById (""). Value = val; Window.close ();}
Why is the getElementById parameter empty?
Anyway, maybe the last person didn't finish it, so let me finish it!!!
There are two pages that have called it.
createsettlementmanage_search.jsp
commissionsettlement.jsp
Maybe the two pages need the same query conditions, anyway, it's the same page, right?
That's what you think, right?
Oh.
I open one of the files
Now, let me just open it.
createsettlementmanage_search.jsp
... function showagentsearch () {var url = "<%=path%>/commission/agentsearch.jsp"; var param = "Dialogwidth:400px;dialogheight:250px;help:no;unadorned:no;resizable:no;status:no"; Return window.showModalDialog (Url,window,param);} ...
<TD class= "Pagecenter" > Agent/Broker: </TD><TD class= "Pagecenter" > <input id= "Agentcode" Name= " Agentcode "type=" text "size=" > <input type= "button" value= ">" onclick= "Showagentsearch ()" > <span s tyle= "COLOR: #FF0000" >*</SPAN></TD>
Well, that's a good writing.
Now, since the ID is agentcode, I'll just fill in the Agentcode in the agentsearch.jsp, okay?
Really is the last person did not finish ah Tut tut, exactly is how anxious things ah, even this ID are unwilling to add
And then I'm going to have to write the ID.
ParWin.document.getElementById ("Agentcode"). Value = val;
The result ran out successfully.
Yes, what do you think?
Okay, and then I opened another file.
commissionsettlement.jsp
... function showagentsearch () {var url = "<%=path%>/commission/agentsearch.jsp"; var param = "Dialogwidth:400px;dialogheight:250px;help:no;unadorned:no;resizable:no;status:no"; Return window.showModalDialog (Url,window,param);} ...
<TD class= "Pagecenter" > Agent/Broker: </TD><TD class= "Pagecenter" > <input id= "agentname" Name= " AgentName "type=" text "size=" > <input type= "button" value= ">" onclick= "Showagentsearch ()" > <span s tyle= "COLOR: #FF0000" >*</SPAN></TD>
Oh, the same thing, when I turn things on ...
Wait a minute
Why did ID become agentname?
Horizontal slots.
How can this, the most basic trust between people
And then there's the time for us to discuss the solution.
What I'm advocating is to copy agentsearch.jsp, change parameters, let one file call this agentsearch.jsp, another file call another agentsearch.jsp
Simple and rude. Yes, that's how I'm not with the secular world.
Longge said there is a div directly in the current page to display just fine, just save the trouble to open a new page
With W2ui or Easyui, the interface can be more beautiful.
Sounds good, but the code is going to be a big change.
Oh.
Brother Tao means that you can pass in a parameter parameter when it is 1 ("Agentcode") when it is ShowModalDialog () and execute getElementById when it is 2 ("getElementById"). AgentName ")
But this has a major problem, showmodaldialog () can only pass in three parameters surl,varguments,sfeatures
> I said we could put the parameters in varguments, there's more harmony.
Longge says ya forget we have to backfill it varguments can only pass the object of the parent window.
> and then Tao says I think we can put a parameter in the URL, just like this
Agentsearch.jsp?parameter=1
Longge and I applaud their wit and say that the future of the party depends on you.
The next step is to implement
The two long files are just a question mark after the URL price parameters will not be re-written
Yes, I'm just lazy.
Now, if you change agentsearch.jsp, you can do it.
Life is so good
<%string parameter=request.getparameter ("parameter");%>...function Backfill () {var val = document.getElementById ("Agentsearch"). Value; var parwin = window.dialogarguments; var parameter = <%=parameter%>; if (parameter = = "1") {parWin.document.getElementById ("Agentcode"). Value = val; }else if (parameter = = "2") {parWin.document.getElementById ("AgentName"). Value = val; }else{alert ("AH (f**k) AH (you)." "); } window.close ();} ...
First get the value of parameter with Request.getparameter ("parameter") above
or 1 or 2.
Of course, under the influence of force majeure, some strange results could be produced.
For example, power off.
then var parameter = <%=parameter%>; is to assign a parameter to a JavaScript script
The next step is to execute judgment.
1 words like this
ParWin.document.getElementById ("Agentcode"). Value = val;
2 words like this
ParWin.document.getElementById ("AgentName"). Value = val;
Please don't mind if the other words get into the mess.
That way, the mission is done.
Here I just want to say to the former classmate who wrote this code
You silly B!
Hui duan!
Shen Me gui!
Ni ma "beep-"!
Son of bick!
There ' s a fire starting in my heart~ reaching a fever piss and it's bringing me out the dark~
Done.
ShowModalDialog () Pass custom parameters (JavaScript fetch URL parameters) to child window and other