HTML - Javascript Help! Cookies Stylesheet Switcher Not Working
Hi, I have a final project due in 3 hours for javascript class. I need to use cookies to change a stylesheet on a page and keep it consistent on every page until the user changes it. The link is http://www-scf.usc.edu/~javery/itp204/finalproject.html
Its a dumb page about my cat. Anyway if you view the source, a lot of the javascript is for the style switch. The user is supposed to switch styles and click Save Style and then it sets that style for every other page. The code is in the other pages too. The style switches but it doesnt save. If anyone can help me it'd be much appreciated! Joel Similar Tutorialshey just wondering if there was a html style switcher, not a php one! if thgere was plz help me and tell me it! Hi, I'm the webmaster of http://english.eduhope.net/ (or rather webmuppet, as a glance at the site will tell, but I haven't found any one else willing to do it). My browsers are rendering the text in most files in verdana, but for all the files in the "news" folder, the text now looks scruffy a**, some Korean sans-serif font that has no business with the latin alphabet. I have no idea why, as all the files use the same stylesheet. The other style elements work fine - is this because they're class level? Perhaps The Webmaster of the parent eduhope.net has changed some php thing? I can't ask him, as we don't share a language, either programming or human. Feel free to insult me, the coding, or the design, but I need help with this. I can't submit links to union news sites dressed like this. Thanks. Can someone tell me how to do stylesheets for html and javascript. I know how to do the files copy in notepad but I need to know what to save them as and what code to use in the head code for the links to the files. I have done one for css with help from here. hey guys, i am working on a project for school and trying to go above and beyond the assignment by placing a srollable table data cell in my table. the web page i am trying to make is for "customer contracts" and i would like to have a "description" section but i dont want a lengthy description making my table huge. if someone could tell me how to turn a <td></td> into either a scrollable data cell or maybe even a clickable link that brings up a seperate bigger text box (if its not too much coding) that would be great. heres the code Code: <xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" omit-xml-declaration="yes" /> <xsl:param name="group" select="//person" /> <xsl:template match="/"> <br /> <br /> <table width="370" cellspacing="0" cellpadding="2"> <tr> <th colspan="5">Contract List</th> <th id="total">Total: <xsl:value-of select="format-number(sum($group/amount),'$#,##0')" /> </th> </tr> <tr> <th>Sign Date</th> <th>Start Date</th> <th>Name</th> <th>Address</th> <th>Job Description</th> <th>Amount</th> </tr> <xsl:apply-templates select="$group"> <xsl:sort select="signDate" data-type="text" order="descending" /> </xsl:apply-templates> </table> </xsl:template> <xsl:template match="person"> <tr> <td width="70"><xsl:value-of select="signDate" /></td> <td></td> <td width="100"><xsl:value-of select="last_name" />, <xsl:value-of select="first_name" /> </td> <td width="130"> <xsl:value-of select="street" /><br /> <xsl:value-of select="city" />, <xsl:value-of select="state" /> <xsl:value-of select="zip" /> </td> <td></td> <td width="70" align="right"> <xsl:value-of select="format-number(amount,'$#,##0')" /> </td> </tr> </xsl:template> </xsl:stylesheet> the code i need to modify it the empty <td></td> tags below <xsl:value-of select="zip" /> thanks in advance for any help and if you know of a link that will help me feel free to post that instead of a lengthy response. I was wondering if it is required to use the following in XHTML. This: HTML Code: <?xml version="1.0" encoding="UTF-8"?> Instead of: HTML Code: <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> And... This: HTML Code: <?xml-stylesheet href="style.css" type="text/css"?> Instead of: HTML Code: <link rel="stylesheet" type="text/css" href="style.css" /> Also, what charset do you recommend and should I use XHTML 2.0 instead of XHTML 1.0? Thanks! - Jason - As some may know I have been trying tom gte my nav menu code ina style sheet, which I thought would be relatively straightforward with a bit of help. I approached the support of my program Serif WebplusX5 yesterday and said; "Please look at http://www.brand-newhomes.co.uk/page134.htm I want to get all the nav code intop an external stylesheet. The page will load faster (better for SEO) Every page wont contain the 120 links (better for SEO - google penguin!) and it will be easier for me to manage and edit without re loading the whole site every time. All in all it is a must have for me! I was advised on the forum that X5 would let me do this and that X5 had external stylesheets. I just need some help with the script and javascript files and links to them. I have with some help managed to do the CSS ones. Can you also tell me where the "Optimise your sites for search engines and speed" is located in X%? I have looked in Site Properties and that is not much better than WP10 that I had been using". This was the reply i got fobbing me off - so much for "support" "Stylesheets are used in WebPlus, but only as far as listing text styles. This doesn't to extend to fully fledged CSS stylesheets I'm afraid. The navigation bars in WebPlus use Flash and in some cases JavaScript. As the nav bars are in this format, you would wee need some form of 3rd party tool / coding to convert this into a CSS stylesheet. I'm afraid as we are essentially modifying the code that WebPlus provides, here in technical support would not be provide help or support on making a stylesheet from a nav bar - my sincerest apologies for this. "Optimize your sites for search engines and speed", as advised on the forum, as a catch all term for a number of different parts of the program. the site checker can detect any problems in the site such as long loading times and the Search section of the Site Properties will help you cerate robots.txt file for SEO purposes, amongst other tools." THIS IS WHY I AM DESPERATE FOR A BIT OF GUIDANCE ON MY OTHER POST AT: http://www.htmlforums.com/html-xhtml...ml-147517.html I have the following code, and it only works in Internet Explorer and Netscape, but I need it to work with those and firefox and opera. HTML Code: <style> body {background: #555555; font-family: arial; margin: 20;} table.body {width: 85%; height: 100%;} td.body {background: #fcfcfc;} table.nav {width: 200; border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black;} td.navbuttonhead {background: url(assets/images/structure/fadebar.png); border-bottom: 1px solid #191919; color: white;} td.navbuttonoff {background: #6a6a6a; border-bottom: 1px solid #191919; border-top: 1px solid #8A8A8A;} td.navbuttonon {background: #8C8C8C; border-bottom: 1px solid #191919; border-top: 1px solid #8A8A8A;} td.navbuttonofftop {background: #6a6a6a; border-bottom: 1px solid #191919;} td.navbuttonontop {background: #8C8C8C; border-bottom: 1px solid #191919;} td.bodyleft {width: 12; background: url(assets/images/structure/bodybgleft.png); border-right: 1px solid black;} td.bodyright {width: 12; background: url(assets/images/structure/bodybgright.png); border-left: 1px solid black;} a.navbutton {text-decoration: none; color: white;} img {border: none;} a.link {color: #404040; text-decoration: none;} a.link:hover {color: #404040; text-decoration: underline;} </style> <table class="nav" cellspacing="0" cellpadding="2" style="margin-bottom: 4;" id="tableCollapsed1" style="display: none;"> <tr> <td class="navbuttonhead"> <a href="#" class="navbutton" onclick="collapse(1)"><div>Test</div></a> </td> </tr> </table> <table class="nav" cellspacing="0" cellpadding="2" style="margin-bottom: 4;" id="tableExpanded1"> <tr> <td class="navbuttonhead"> <a href="#" class="navbutton" onclick="expand(1)"><div>Test</div></a> </td> </tr> <tr> <td class="navbuttonofftop" onmouseover="className='navbuttonontop'" onmouseout="className='navbuttonofftop'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> <tr> <td class="navbuttonoff" onmouseover="className='navbuttonon'" onmouseout="className='navbuttonoff'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> <tr> <td class="navbuttonoff" onmouseover="className='navbuttonon'" onmouseout="className='navbuttonoff'"> <a href="#" class="navbutton"><div style="padding-left: 2;">Text</div></a> </td> </tr> </table> <script type="text/javascript"> function expand(id) { document.getElementById("tableCollapsed" + id).style.display="none"; document.getElementById("tableExpanded" + id).style.display="block"; } function collapse(id) { document.getElementById("tableExpanded" + id).style.display="none"; document.getElementById("tableCollapsed" + id).style.display="block"; } </script> Any help would be nice. hi, i have a problem with my javascript---i have an image changer, and when you click on the name of the image it changes the image and the link to view the full size image. in firefox and chrome, this works fine, but in IE it displays only the URL for the image on click. the website is http://sc-lee.com/art.html , to view/test, and the code is: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="branch2.css" rel="stylesheet" type="text/css" /> <script> var thelink = 'http://sc-lee.com/art/2l.jpg'; </script> </head> <body> <div id="navss"><B>OTHER WORK</B> <a href="art.html">paintings & drawings</a> / <a href="collage.html">collage</a> / <a href="graphics.html">graphics</a> </div> <div id="back"><a href="javascript: history.go(-1)">< back</a></div> <div id="contenta"> <img src=art.gif /> <br> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/2.jpg'; var thelink = 'http://sc-lee.com/art/2l.jpg'">ONE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/1.jpg'; var thelink = 'http://sc-lee.com/art/1l.jpg'">TWO</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/3.jpg'; var thelink = 'http://sc-lee.com/art/3l.jpg'">THREE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/4.JPG'; var thelink = 'http://sc-lee.com/art/4l.jpg'">FOUR</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/5.jpg'; var thelink = 'http://sc-lee.com/art/5l.jpg'">FIVE</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/6.jpg'; var thelink = 'http://sc-lee.com/art/6l.jpg'">SIX</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/7.jpg'; var thelink = 'http://sc-lee.com/art/7l.jpg'">SEVEN</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/9.jpg'; var thelink = 'http://sc-lee.com/art/9l.jpg'">EIGHT</a> <br><a href="javascript: document.getElementById('img1').src='http://sc-lee.com/art/11.jpg'; var thelink = 'http://sc-lee.com/art/11l.JPG'">NINE</a> </div> <div id="contentb"> <img id="img1" name="mainimage" src="http://sc-lee.com/art/2.jpg"> <br /> <a href="#" onclick="javascript: window.open(thelink); "> + fullsize</a> </div> </body> </html> i'm afraid i just don't know enough about the differences between IE and firefox javascript compatability to fix this. please help! thanks, stephanie hello i am new to javascript and i can't figure out why this code will not sort the user's line of text into alphabetical order. any help would be great thank you Code: <html> <head> <title> JavaScript array sort() alphabetically </title> <script type="text/javascript"> var arr = new Array(1); arr[1]=prompt("enter a line of text") document.write("Original Array is: "+arr+"<br>"); document.write("Sorted array is: "+arr.sort()+"<br> "); </script> </head> </body> </html> So I am using internal javascript in my html doc. to make my cursor "sparkle". The script works fine because it shows no problem if I do not declare a doctype at all, but once I declare a doctype the cursor effect no longer works...why?? As of now I use doctype html4 frameset on "index.html" and html5 for all other pages (but I have tried several combinations both on my localhost and on my global server. Anyone know why this is occurring? Thanks Hi Guys, Hope this is the correct forum for this thread. How do you put a cookie on someones computer when they visit your website? Thanks Cookies?! What are they and do I really need one? By the way, check this out www.esaurome.com/index.html and tell m what you think... Also, is it better to give files a .htm or .html extension? Any difference between the 2? hi, what is cookies and sessions .I have listen many times but don't know.. If u know plz tell. Thanks, web development I was hoping you could help me with a problem that came up at work today since I've never worked with this sort of thing before - cookies. This has to do with affiliate marketing. To put things short, my company uses cookies to track the referrer's username (ie the person through whom new users register). This is in turn tracked by our servers and the affiliates are paid a commission for every referral. Basically this process works perfectly in firefox, safari and chrome browsers but not in internet explorer. It seems to be quite random because it does work on the rare occasion but it mostly doesn't save the cookies that contain the username of the affiliate and therefore we cannot track the referrals made through internet explorer by the users. Do you have any idea or experience regarding this? By the way, this is done through a tracking url using redir.cgi and adding the values in the address itself (for example: http://www.---.com/cgi-bin/redir.cgi...le=123&lang=en). I've tried to research about what might be the cause of the problem but all I found were other people complaining that internet explorer gives problems but no solutions. Do you have any idea how this tracking works? Thanks a lot, I would appreciate your help Help Me With Cookies, HTML and IE8 For complex reasons, I have to use HTML with JavaScript to set a cookie. I know it is easy to set and get cookies PHP but I have to put the code in HTML. I have searched the internet for some examples and I ran a test based on an example. I ran this Javascript code: Code: <SCRIPT LANGUAGE="JavaScript"> function putCookie() { cookie_name = "specialcookiehuge"; if(document.cookie != document.cookie) { index = document.cookie.indexOf(cookie_name); } else { index = -1; } if (index == -1) { document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; } } </SCRIPT> I tested this code by placing alert statements and I nkow that the line: Code: document.cookie=cookie_name+"; expires=Monday, 04-Apr-2020 05:00:00 GMT"; gets run. I tried to find this cookie (Tools -> Internet Options -> Browsing History ->Settings) And I did not find anything named "specialcookiehuge" in "View Objects" or "View Files". I guess I could try other browsers, but it would be good to know what I am doing wrong. I do not know if I am really setting a cookie. Is there some additional javascript command I am missing? Or, is the cookie being set but I am not looking in the right place according to the tutorials I saw online? Is there any way that cookies will work with frames that are showing a site on a different server? Hi, i have the following form, it doesnt do much: Code: <form method="post" > <INPUT TYPE=TEXT SIZE=40 NAME=data value=""> <br> <INPUT TYPE=TEXT SIZE=40 NAME=data value=""> <br> <input TYPE=SUBMIT NAME=data value="Login" > </form> I would like the values to be filled in by obtaining data from a cookie, the function which which gets the cookie data is the following: Code: function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if(c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } Just wondering if anyone could help me call this function from the form, so that i can fill in the values. Thanks Hello (this may sound like a confusing post), I have a website that I recently created, and am having some trouble with newly updated pages loading. I had the site set up and finalized, and I uploaded it through my ftp program. The site works fine, then I was instructed to change certain pages. Since I changed certain pages, I have to now refresh each page I go on in order to see the new updated pages (since I already viewed the page on my computer, and it's set in my cookies). I know that I can delete the cookies on my own computer, but I want people who don't know how to do that who have already viewed the webpage, to be able to come back to the site and automatically see the page updates. So in a nutshell - all I want to know is if there is a code I can place in my html that will make it so my site is not stored in anyones cookies. Thanks in advance to anyone who offers suggestions or advice!! |