/    Sign up×
Community /Pin to ProfileBookmark

Javascript problem in setting URL

Javascript problem in setting URL
I’m having difficulty in setting up the URL in by Javascript.
I have:

[code]
<script language=”JavaScript” type=”text/javascript”>
<!–
function go1(Keyword,Keywordc,Keywordb,Keywordd,Keyworde,Keywordf,Keywordg,Keywordh)
{
document.getElementById(‘ifrVerse’).src=’showversea.asp?id=’ + [color=red]document.bookSelect.id1.options[document.bookSelect.id1.selectedIndex].value[/color] + ‘&keyword=’ + Keyword.replace(/[ ]/g,’+’) + ‘&keywordc=’ + Keywordc

}
function go2(Keyword,Keywordc,Keywordb,Keywordd,Keyworde,Keywordf,Keywordg,Keywordh)
{
document.getElementById(‘ifrVerse2′).src=’showversea.asp?id=’ + [color=red]document.bookSelectb.id2.options[document.bookSelectb.id2.selectedIndex].value[/color] + ‘&keyword=’ + Keyword.replace(/[ ]/g,’+’) + ‘&keywordc=’ + Keywordc
}

//–>
</script>
[/code]

This is the URL I get:
/showversea.asp?id=[color=red]8654[/color]&keyword=[color=red]8654[/color]&keywordc=[color=blue]king[/color]

As you see [color=red]8654[/color] is written twice. And [color=blue]king[/color] is bumped over to &keywordc. It should be with &keyword.

I have 2 forms:

[code] <form name=”bookSelect” action=”showversea.asp” method=”get” target=”ifrVerse”>
<select name=”id1″ id=”id1″ size=”10″ style=”width:200;” onchange=”go1(document.getElementById(‘id1′).value,'<%=Keyword%>’,'<%=Keywordc%>’);”>
[/code]

and

[code] <form name=”bookSelectb” action=”showversea.asp” method=”get” target=”ifrVerse2″>
<select name=”id2″ id=”id2″ size=”10″ style=”width:200;” onchange=”go2(document.getElementById(‘id2′).value,'<%=Keyword%>’,'<%=Keywordc%>’);”>
[/code]

The iFrames I have no problem with but here they are:

[code]
<iframe
src =”/wheelofgod/kjvresplistbox.asp”
width=”300″ height=”1200″ name=”ifrVerse” id=”ifrVerse”>
</iframe>

</td>
<td>
<iframe
src =”/wheelofgod/kjvresplistbox.asp”
width=”300″ height=”1200″ name=”ifrVerse2″ id=”ifrVerse2″>
</iframe>
[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@torunforeverFeb 16.2006 — You have

'&keyword=' + Keyword.replace(/[ ]/g,'+')

where Keyword is

document.getElementById('id1').value

which will return

8654

If you want &keyword=king then you need to set '&keyword=' + Keywordc
×

Success!

Help @gilgalbiblewhee spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...