after refresh value in the drop down list is not coming

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
singhsugandha3
Forum Newbie
Posts: 2
Joined: Wed Aug 03, 2011 11:28 pm

after refresh value in the drop down list is not coming

Post by singhsugandha3 »

Code: Select all

<script type="text/javascript">

function f1(a)
{

if(a==1)
{

window.location= "http://kansascityrehabloans.com/index.php?&pf=3";

}
if(a==2)
{

window.location= "http://kansascityrehabloans.com/index.php?&pf=4";
}
else if(a==3)
{
window.location = "http://kansascityrehabloans.com/index.php?&pf=5";
}
if(a==4)
{
window.location = "http://kansascityrehabloans.com/index.php?&pf=6";
}
if(a==5)
{
window.location = "http://kansascityrehabloans.com/index.php?&pf=7";
}

}
</script>

<form name="frm">
<center><span>Select Loan type : </span>
<select size="1" style="width:135px;"  onchange="javascript:f1(this.value);" name="ddl" id="ddl">

<option value="0">Select One</option>
<option value="1">New Home Loan</option>
<option value="2">Refinance Home Loan</option>
<option value="3">Relocation Home Loan</option>
<option value="4">Strategic Partner</option>
<option value="5">General Inquiry</option>
</select>
</center>
</form>
Last edited by Benjamin on Thu Aug 04, 2011 12:48 am, edited 1 time in total.
Reason: Added [syntax=php|sql|css|javascript] and/or [text] tags.
singhsugandha3
Forum Newbie
Posts: 2
Joined: Wed Aug 03, 2011 11:28 pm

select option

Post by singhsugandha3 »

How to get selected value of html select/dropdown list with Javascript

Code: Select all

<script type="text/javascript">

function f1(a)
{
if (a==1)
{
document.getElementById("ddl").options[1].selected=true;
window.location= "http://kansascityrehabloans.com/index.php?&pf=3";
}
if(a==2)
{
document.getElementById("ddl").options[2].selected=true
window.location= "http://kansascityrehabloans.com/index.php?&pf=4";
}
if(a==3)
{
document.getElementById("ddl").options[3].selected=true
window.location = "http://kansascityrehabloans.com/index.php?&pf=5";
}
if(a==4)
{
document.getElementById("ddl").options[4].selected=true
window.location = "http://kansascityrehabloans.com/index.php?&pf=6";
}
if(a==5)
{
document.getElementById("ddl").options[5].selected=true
window.location = "http://kansascityrehabloans.com/index.php?&pf=7";
}

}
</script>

<form name="frm">
<center><span>Select Loan type : </span>
<select size="1" style="width:135px;"  onchange="f1(this.value)" id="ddl">

<option value="0">Select One</option>
<option value="1">New Home Loan</option>
<option value="2">Refinance Home Loan</option>
<option value="3">Relocation Home Loan</option>
<option value="4">Strategic Partner</option>
<option value="5">General Inquiry</option>
</select>
</center>
</form>
Last edited by singhsugandha3 on Thu Aug 04, 2011 1:35 am, edited 4 times in total.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: after refresh value in the drop down list is not coming

Post by Benjamin »

Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums. Functions in your code will be automatically linked to manual entries and your code will be syntax highlighted making it much easier for everyone to read. You will most likely receive more answers as well.

[quote="Forum Rules"]
11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
[/quote]

[quote="Forum Rules 1 1.1 4"]
4. All users of any level are restricted from bumping ([url=http://en.wikipedia.org/wiki/Bump_(internet)]as defined here[/url]) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not receive a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
[/quote]

You may also want to read:
[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url]
[*][url=http://php.net/]PHP Manual[/url]
[*][url=http://www.google.com/search?client=opera&rls=en&q=php+tutorials&sourceid=opera&ie=utf-8&oe=utf-8]PHP Tutorials[/url][/list]
Post Reply