Results 1 to 4 of 4

Thread: How do I add keyword to the javascripted url?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    How do I add keyword to the javascripted url?

    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:
    Code:
    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:
    	<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&nbsp;13:3</option>
    				
    				<option  value="8319">2 Samuel&nbsp;13:1</option>
    
    				
    				<option  value="8322">2 Samuel&nbsp;13:4</option>
    				
    				<option  value="8333">2 Samuel&nbsp;13:15</option>
    				
    				<option  value="12698">Nehemiah&nbsp;13:26</option>
    				
    				<option  value="16341">Psalms&nbsp;145:20</option>
    				
    				<option  value="16772">Proverbs&nbsp;13:24</option>
    
    				
    				<option  value="18774">Isaiah&nbsp;57:8</option>
    				
    				<option  value="26632">John&nbsp;13:1</option>
    				
    				<option  value="26654">John&nbsp;13:23</option>
    				
    				<option  value="26665">John&nbsp;13:34</option>
    				
    				<option  value="26666">John&nbsp;13:35</option>
    
    				
    				<option  value="28275">Romans&nbsp;13:8</option>
    				
    				<option  value="28276">Romans&nbsp;13:9</option>
    				
    				<option  value="28277">Romans&nbsp;13:10</option>
    				
    				<option  value="29055">2 Corinthians&nbsp;13:11</option>
    				
    				<option  value="29058">2 Corinthians&nbsp;13:14</option>
    
    				
    				<option  value="30243">Hebrews&nbsp;13:1</option>
    				
    		</select>
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do I add keyword to the javascripted url?

    HTML Code:
    function go1()
    		{
    		window.frames.ifrVerse.location.href = "showversea.asp?id=" + document.getElementById('myddl').options[document.getElementById('myddl').selectedIndex].value;
    		booksa.submit();
    		}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: How do I add keyword to the javascripted url?

    Code:
    	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();
            }
    The alert says:
    Code:
    http://127.0.0.1/wheelofgod/showversea.asp?id=identity&keyword=keyword
    How can I make identity = the value of the option in the select dropdown?

    And secondly, how can I make
    keyword = <%=Keyword%> ?

    Code:
    			<form name="bookSelect" action="showversea.asp" method="get" target="ifrVerse">
    			<select name="id" size="10" style="width:200;" onchange="go1('identity','keyword');">
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do I add keyword to the javascripted url?

    To get the value in your dropdown, use document.getElementById('ddl1').options[document.getElementById('ddl1').selectedIndex].value

    Concatenate this to your string.

    Second, do not use 'id' is the name of your dropdownlist. That is poor practice and may conflict in your javascript. Also give an id value to your dropdownlist.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width