| | |
form menu style sheet changer
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Oops; the problem is that that code is self-restricting.
Any value in the cookie overrides the value from the form; so, once you submit once, you can't submit again.
Corrected part: (ASP only)
Seems like a minor thing, but it'll make all the difference =P
Any value in the cookie overrides the value from the form; so, once you submit once, you can't submit again.
Corrected part: (ASP only)
<%@ LANGUAGE="JAVASCRIPT" %> <% var style = new String(Request.Form('style')); if(style==null || style==''){ style = new String(Request.Cookies('style')); if(style==null || style==''){ style="default"; } }else{ Response.Cookies('style') = style; } %>
Seems like a minor thing, but it'll make all the difference =P
Last edited by MattEvans; Jan 26th, 2007 at 7:13 pm.
Plato forgot the nullahedron..
yay it works!! the only thing is the cookie isnt working. i have added a second page to the folder and the 2 pages link to eachother so as to test the asp cookie however its not working. Also, how do you make the default style sheet be styles_1.css? Thanks,
Max
Max
Ill solve somebody's thread someday! xD
hmmm, i had a quick visit to your page (from that link) with cookies cleared and cookie notifications switched on. The first event is a request to set the style cookie to 'undefined':
So, that means the if(style==null || style='undefined') checks were probably correct... it's a bit weird that O_o. Go with a full test just in case:
the line in blue is where you should define the default stylesheet's filename suffix, so a '1' will make the default sheet /styles/style_1.css.
HTML and CSS Syntax (Toggle Plain Text)
This page wishes to set the cookie style="undefined" This value will only be sent to documents on the server grafax.co.uk, and paths that are starting in /. The cookie will be deleted when Opera is closed. ---------------------- Full cookie request: style=undefined; path=/
So, that means the if(style==null || style='undefined') checks were probably correct... it's a bit weird that O_o. Go with a full test just in case:
<%@ LANGUAGE="JAVASCRIPT" %>
<% var style = new String(Request.Form('style'));
if(style==null || style=='undefined' || style==''){
style = new String(Request.Cookies('style'));
if(style==null || style=='undefined' || style==''){
style="1";
}
}else{
Response.Cookies('style') = style;
}
%>the line in blue is where you should define the default stylesheet's filename suffix, so a '1' will make the default sheet /styles/style_1.css.
Last edited by MattEvans; Jan 27th, 2007 at 6:46 pm.
Plato forgot the nullahedron..
Yay it works!
2 more things.. how do you make it so when you select a new style sheet for the pages it goes there automatically when you press it, rather than having to press the submit button?
Also, how can i make it so the selected option is the style sheet being used? for example, if style sheet 2 was being used, option 2 in the menu would be selected?
Thanks,
Max
2 more things.. how do you make it so when you select a new style sheet for the pages it goes there automatically when you press it, rather than having to press the submit button?
Also, how can i make it so the selected option is the style sheet being used? for example, if style sheet 2 was being used, option 2 in the menu would be selected?
Thanks,
Max
Ill solve somebody's thread someday! xD
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: Problems with CSS in IE
- Next Thread: Html
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash font fonts form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl






