Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
jasonwsaz #1
Global variable or cookie in javascript
Ok heres the problem... I have a list of music that is searchable. I designed
it in coldfusion and want to add a little javascript to be able to change the
text size. Currently the following code works, but then when you search again
after changing the text size it will revert back to the default text size. I
believe that this can be done using a global variable but I'm not sure how I
would do it in this situation. Also I believe that I could use a cookie but I
would prefer not to if possible.
This is the link to the page...
[url]www.jasonschwab.com/music.cfm[/url]
The javascript....
--------------------------------------------------------------
<script language="javascript">
function ChangeFontSize(size) {
id = "results";
document.getElementById(id).style.fontSize = size + "px";
}
</script>
--------------------------------------------------------------
The html......
--------------------------------------------------------------
<a href="#" onclick="ChangeFontSize('20')">Change to 20px</a><br>
<a href="#" onclick="ChangeFontSize('28')">Change to 28px</a><br>
<a href="#" onclick="ChangeFontSize('36')">Change to 36px</a>
<TABLE id="results">
<TR>
<TD>
This is the text that I would like to change
</TD>
</TD>
</TABLE>
--------------------------------------------------------------
Now don't get me wrong...The above code does work, but when I search again,
this changed font size value is lost. How do I get it so that once someone
clicks to change the font size it will stay that font size until they close the
browser?
What I think might need to be done is to somehow pull a variable out of the
function and then set that as the default value...But I' really not sure...
Thanks again,
Jason
jasonwsaz Guest
-
cookie variable
Hi everyone. Im not a coldfusion programmer nor user. I didn't know where to turn for help so I came on this board. The trouble I am having is a... -
Javascript Cookie help
Hi, I have a site that already has a cookie. what I need to do is append to that cookie. So it's got a variable and value right now such as... -
Ever tried to set cookie expiry date using JavaScript?
Hi all. I'm trying to set a cookie expiry date but my script is JS (JavaScript). I've tried Response.Cookies("Test").Expires = Date();... -
Help Please: 'Warning 5001 global variable "iF_timer" already defined in global scope
Hi there, I have just started to get this error: 'Warning 5001 global variable "iF_timer" already defined in global scope The variable name... -
passing javascript variable into asp variable using vbscript
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script... -
delaneypub #2
Re: Global variable or cookie in javascript
Setting a cookie will let you set the font size from the cookie from that time
forward. You could also pass a variable from page to page with the chosen font
size. If this is a search page, then there's likely a form on it, and you can
use a hidden field in the form to pass the variable. This would probably work
out best when the user will be mostly going back and forth between the form
page and the action page.
delaneypub Guest



Reply With Quote

