How do I add keyword to the javascripted url? It's for the onchange and the iFrame. Once the dropdown is selected then the iFrame would show the verse. I have an old code that looked like this: location = "kjvresplistboxshowversea.id.options[document.myForm.id.selectedIndex].value + "&Keyword=" + document.myForm.Keyword.value + "&Keywordb=" + document.myForm.Keywordb.value + "&Keywordc=" + document.myForm.Keywordc.value + "&Keywordd=" + document.myForm.Keywordd.value + "&Keyworde=" + document.myForm.Keyworde.value + "&Keywordf=" + document.myForm.Keywordf.value + "#bcv Code (markup): <script language="JavaScript" type="text/javascript"> <!-- function go1() { booksa.action = "showversea.asp?id="; booksa.submit(); } //--> </script> <form name="booksa" action="showversea.asp" method="get" target="ifrVerse"> <select name="id" size="10" style="width:200;" onchange="go1();"> <option value="5276">Deuteronomy 13:3</option> <option value="8319">2 Samuel 13:1</option> <option value="8322">2 Samuel 13:4</option> <option value="8333">2 Samuel 13:15</option> <option value="12698">Nehemiah 13:26</option> <option value="16341">Psalms 145:20</option> <option value="16772">Proverbs 13:24</option> <option value="18774">Isaiah 57:8</option> <option value="26632">John 13:1</option> <option value="26654">John 13:23</option> <option value="26665">John 13:34</option> <option value="26666">John 13:35</option> <option value="28275">Romans 13:8</option> <option value="28276">Romans 13:9</option> <option value="28277">Romans 13:10</option> <option value="29055">2 Corinthians 13:11</option> <option value="29058">2 Corinthians 13:14</option> <option value="30243">Hebrews 13:1</option> </select> Code (markup):
Hey, Actually you do not need a javascript. If you are just looking to pass the ID number to the iframe what you have will work. Simply pull the "id" from the ASP script. If you submitted the form you gave above the form will pass: showversea.asp?id=NUMBER
The reason I want to add the keyword &keyword= is because showversea.asp has highlighting coding on the keyword. I want the searched keyword highlighted. I'm not asking for an highlighting code. I just want to know how to place through javascript in the url.
Ah I see. Were are you keywords being pulled? I do not see them in the code posted. Are they pulled from a second field?
Keyword comes from kjv.asp. It also appears in the response page kjvresp.asp (in the url): kjv.asp | | kjvresp.asp--iFrame kjvresplistbox.asp--iFrame showversea.asp The &keyword= must appear in the showversea.asp's url. The reason I want to add the keyword &keyword= is because showversea.asp has highlighting coding on the keyword. I want the searched keyword highlighted. I'm not asking for an highlighting code. I just want to know how to place through javascript in the url. The keyword already appears in the kjvresp.asp's url. Here's what I'm talking about: http://i.domaindlx.com/wheelofgod/kingjames.asp
I see, first I like the way you have the site setup easy to see the verses. well look at your code you did: booksb.action = "showversea.asp?id=&Keyword=Abraham"; Code (markup): So you did it pretty much how it should be. Instead of writing the "keyword" direct into the URL place it into a variable var jsKeyword=<%Keyword%>; var bookid=document.FORMNAME.id.seletedIndex; var id=document.FORMNAME.id.options[bookid].value; books.action="showversea.asp?id="+id+"&Keyword="+jsKeyword; Code (markup): Not sure if it will work, but atleast I know the idea is sound Its what I use when I combine php/asp with Javascript.
I had come up with this before I read your suggestion. (But I tried it and I got the same result below). keyword='brutish' function go1(identity,keyword) { document.forms['bookSelect'].action = 'showversea.asp?id=' + identity + '&keyword=\'' + keyword + '\'' //bookSelect.action = 'showversea.asp?id=' + identity + '&keyword=' + keyword; alert(bookSelect.action); //bookSelect.submit(); } Code (markup): The alert says: http://127.0.0.1/wheelofgod/showversea.asp?id=[color=red]identity[/color]&keyword=[color=red]keyword[/color] Code (markup): How can I make identity = the value of the option in the select dropdown? And secondly, how can I make keyword = <%=Keyword%> ? <form name="bookSelect" action="showversea.asp" method="get" target="ifrVerse"> <select name="id" size="10" style="width:200;" onchange="go1('identity','keyword');"> Code (markup):
Ok Let me redirect my goal. I have set an alert. It says: http://127.0.0.1/showversea.asp?id=15418&keyword=brutish Code (markup): But when the iFrame opens it writes only this in the URL. http://127.0.0.1/wheelofgod/showversea.asp?id=15418 Code (markup): The second URL shows what the select name "id" is picking up "15418" from the option value. But it fails to pick up the "keyword" <%=Keyword%>. The page of dropdown is ASP-generated, in other words the ASP builds the dropdown from the result of the database table. Here is the section of the source: <script language="JavaScript" type="text/javascript"> <!-- function go1(identity,keyword) { document.forms['bookSelect'].action = 'showversea.asp?id=' + identity + '&keyword=' + keyword alert(bookSelect.action); bookSelect.submit(); } //--> </script> Code (markup): And <form name="bookSelect" action="showversea.asp" method="get" target="ifrVerse"> <select name="id" size="10" style="width:200;" onchange="go1(document.forms['bookSelect'].id[document.forms['bookSelect'].id.selectedIndex].value,'brutish');"> <option value="14659">Psalms 49:10</option> [COLOR=Red]<option value="[B]15418[/B]">Psalms 92:6</option>[/COLOR] <option value="15440">Psalms 94:8</option> <option value="16721">Proverbs 12:1</option> <option value="17254">Proverbs 30:2</option> <option value="18016">Isaiah 19:11</option> <option value="19210">Jeremiah 10:8</option> <option value="19216">Jeremiah 10:14</option> <option value="19223">Jeremiah 10:21</option> <option value="20230">Jeremiah 51:17</option> <option value="20976">Ezekiel 21:31</option> </select> Code (markup):