Jump to content

Desired Option Selected After Page Refresh


shobhit.singh783

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.

Link to comment
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???

Link to comment
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
Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...