•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 425,929 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,707 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1107 | Replies: 1
![]() |
•
•
Join Date: Sep 2006
Posts: 45
Reputation:
Rep Power: 3
Solved Threads: 0
Hi everybody
I am trying to develop an application, in which i want your help and suggestions.
I have a master page and many content pages. I want to write a javascript function in the master page script, and call that function in body onload.
I have a field in User table, which has the CSS files choosen by that user. The field value is just the file name, but not with extension .css
I have a stored procedure which retuns this CSS field values, if supplied userid.
The problem is that, I am not getting an idea how to write the function, which executes the stored procedure, taking userid as parameter, and then get the returned value, adding a .css extension to that, and assiging that field value.css to the href of the link?
Can anyone please help me in this?
Thanks
I am trying to develop an application, in which i want your help and suggestions.
I have a master page and many content pages. I want to write a javascript function in the master page script, and call that function in body onload.
I have a field in User table, which has the CSS files choosen by that user. The field value is just the file name, but not with extension .css
I have a stored procedure which retuns this CSS field values, if supplied userid.
The problem is that, I am not getting an idea how to write the function, which executes the stored procedure, taking userid as parameter, and then get the returned value, adding a .css extension to that, and assiging that field value.css to the href of the link?
Can anyone please help me in this?
Thanks
•
•
Join Date: Jun 2006
Location: UK (Bristol)
Posts: 225
Reputation:
Rep Power: 3
Solved Threads: 1
From what you say, it sounds like your stored proceedure is a server side script that returns some stored information about a user's preferences when the user logs in. If this is so I would advise the following. Get the stored proceedure to serve a page with a script in it that sets a cookie:
You can find info about how to correctly set a cookie here. So, the server side script generates the correct javascript code to set a cookie when that code is run on the client machine. Then, make your javascript app. read the cookie and set the link based on this:
A couple of things to note here:
1. This is a rough sketch of what you might need to do. I'm not an expert so there might be mistakes in there.
2. Remember that your server side script will need to generate the correct javascript code to set the cookie in the first place, or this won't work.
Hope this gives you some ideas.
Steven.
HTML Syntax (Toggle Plain Text)
<body> <script type="text/javascript">document.cookie='user_info=my_style_sheet; expires=Fri, 26 Jan 2007 21:08:00; path=http://your_domain.com'; setTimeout("set_link()", 2000)</script>
You can find info about how to correctly set a cookie here. So, the server side script generates the correct javascript code to set a cookie when that code is run on the client machine. Then, make your javascript app. read the cookie and set the link based on this:
HTML Syntax (Toggle Plain Text)
<head> <script type="text/javascript"> function set_link() { var cookie = document.readCookie('user_info'); var crumbs = cookie.split(=); var style = crumbs[1]; var file_name = style + ".css"; document.write("<a href=\"file_name\">Your style</a>"); } </script>
A couple of things to note here:
1. This is a rough sketch of what you might need to do. I'm not an expert so there might be mistakes in there.
2. Remember that your server side script will need to generate the correct javascript code to set the cookie in the first place, or this won't work.
Hope this gives you some ideas.
Steven.
Last edited by Mushy-pea : Jan 26th, 2007 at 4:33 pm.
Hello, you're through to Steven on the BT Business technical help desk. Could I take your broadband telephone number please?
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- database connection(select ,insert query) within javascript function (JSP)
- Javascript Function Link (JavaScript / DHTML / AJAX)
- Javascript Function to reload DOM Element? (JavaScript / DHTML / AJAX)
- Trying to get a javascript function to play a sound (JavaScript / DHTML / AJAX)
- Javascript help please (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Html Woes
- Next Thread: Am I right here?


Linear Mode