Jump to content
Sign in to follow this  
shobhit.singh783

Desired Option Selected After Page Refresh

Recommended Posts

Hi,Below is code for three options and fourth one is none value and selected.I want this--> when I select any option like option Campaign Report One for value="1" and data displays on page. I want when I refresh the page then I look 4th option value="none" is selected in place of option Campaign Report One for value="1" selected.

<html>...Select Campaign:<select name="campaigns" onchange='writebox(this.form);'>	<option value="1">Campaign Report One</option>	<option value="2">Campaign Report Two</option>	<option value="3">Campaign Report Three</option>	<option value="none" selected>------Select option------</option></select>...</html>

Anybody please post suggestions.

Share this post


Link to post
Share on other sites

You can try this:

<option name="  " selected="selected"> This option </option>

As for the Refresh, I'm pretty sure a refresh will carry the selected value forward with it. You would need to 'recycle' the URL by clicking on the address bar then enter to reset the list, I think.And why no Doctype???

Share this post


Link to post
Share on other sites
You can try this:
<option name="  " selected="selected"> This option </option>

As for the Refresh, I'm pretty sure a refresh will carry the selected value forward with it. You would need to 'recycle' the URL by clicking on the address bar then enter to reset the list, I think.And why no Doctype???

I also tried this but still problem is same.Other thing you posted here I am getting little bit but If you or anyone post in detail then it will help me to solve my problem..Regards

Share this post


Link to post
Share on other sites

On refresh the last selected option will be displayed. You cannot override this with HTML but you can with some javascript. You'll need to read the javascript tutorials to understand this properly but the basic idea will be to set an onload event on the body which will call a javascript function which you will define in the head to set the selected option to "none". If you need more help with this then post in the javascript forum.As jlhaslip says, you should really have a doctype too. It might make things easier in the long run. Have a read of this: w3Schools DOCTYPE.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...