| | |
Random CSS
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2006
Posts: 10
Reputation:
Solved Threads: 0
Hello there, I need my page to randomly select a CSS document. I don't want the user to select it, but instead to do it when the page loads.
This is the script I have so far:
This function does write the proper <style> tag, but it does not work. :evil: When I go to "view source", I don't see the line that suppously was written by the JS function.
PLEASE HELP!!:-|
This is the script I have so far:
<script language="javascript" type="text/javascript">
var ranNum= Math.floor(Math.random()*3+1);
document.write("<link rel='stylesheet' href='hd"+ranNum+".css' type='text/css'>");
</script>This function does write the proper <style> tag, but it does not work. :evil: When I go to "view source", I don't see the line that suppously was written by the JS function.
PLEASE HELP!!:-|
•
•
Join Date: Feb 2006
Posts: 50
Reputation:
Solved Threads: 1
•
•
•
•
When I go to "view source", I don't see the line that suppously was written by the JS function.
Site admin at NetBulge.com, a place set out to improve the web 1 good article at a time :)
•
•
Join Date: Apr 2006
Posts: 21
Reputation:
Solved Threads: 0
•
•
•
•
I need my page to randomly select a CSS document. I don't want the user to select it, but instead to do it when the page loads.
█ WeLoveCSS.com • XHTML/CSS Forum for beginners to advanced users
Can't find any good CSS Forums? WLC is the right place for you!
Can't find any good CSS Forums? WLC is the right place for you!
•
•
Join Date: Apr 2006
Posts: 10
Reputation:
Solved Threads: 0
Me again, sorry for the late response, it was the weekend.
I don't want the user to select the a CSS and then refresh the page. I want to do that for them.
The way I have setup my page is that I have one CSS for the whole page: styles.CSS, and then I have 3 other CSS documents (hd1.css, hd2.css, hd3.css) that I want to use them in the document randomly.
Here is the page
http://www.arch.usyd.edu.au/~jrui0688/template.htm
(this is the testing page).
I don't want the user to select the a CSS and then refresh the page. I want to do that for them.
The way I have setup my page is that I have one CSS for the whole page: styles.CSS, and then I have 3 other CSS documents (hd1.css, hd2.css, hd3.css) that I want to use them in the document randomly.
Here is the page
http://www.arch.usyd.edu.au/~jrui0688/template.htm
(this is the testing page).
![]() |
Similar Threads
- Random CSS Stylesheet selector exists? (JavaScript / DHTML / AJAX)
- A CSS Question - Stoping Fonts from Becoming Giants! (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Text Not Showing up in IE, Fine in Firefox * NS
- Next Thread: how do i change fore color in a textbox with javascript
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n






