|
-
Jul 3rd, 2003, 08:11 PM
#1
Thread Starter
Member
Could Anyone Convert this JScript to VBScript please
I am just learning VB and VBScript. I came accross a nice piece of code written in jscript... since I do not know a word of that could someone please convert the following to VBScript?
Code:
function setActiveCSS(title){var i,a,main;for(i=0;(a =document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")){a.disabled=true;if(a.getAttribute("title")==title)a.disabled=false;}}}
function getActiveCSS(){var i,a;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")&&!a.disabled)return a.getAttribute("title");}return null;}
function getPreferredCSS(){var i,a;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("rel").indexOf("alt")==-1&&a.getAttribute("title"))return a.getAttribute("title");}return null;}
function setCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires=";expires="+date.toGMTString();}else expires="";document.cookie=name+"="+value+expires+"; path=/";}
function getCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}return null;}
window.onload=function(e){var cookie=getCookie("css");var title=cookie?cookie:getPreferredCSS();setActiveCSS(title);}
window.onunload=function(e){var title=getActiveCSS();setCookie("css",title,512);}
TIA
Last edited by Programmer_n00b; Jul 3rd, 2003 at 09:54 PM.
Is the answer 42?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/O dpu(-)@ s++:+ a-->? C+++>--@ UL>B++++ P+>++++ L+(--) E--- W++>+++ N
o? K- w+++>+++++$ O--->---- M->-- V? PS+ PE Y? PGP--- t+(-) 5? X-(++) R*
tv++>! b+ DI+++>++++>+++++ D++ G>+++ e*>+++++ h!(*)>++ r%>$ x+>$
------END GEEK CODE BLOCK------
-
Jul 7th, 2003, 05:36 AM
#2
Looks like client-side code to me. Why on earth would you want to convert it to VBScript?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 9th, 2003, 10:18 AM
#3
Thread Starter
Member
I thought you could run VBScript client side by using the;
<script type="text/vbscript">
blah blah
</script>
tags
Is the answer 42?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/O dpu(-)@ s++:+ a-->? C+++>--@ UL>B++++ P+>++++ L+(--) E--- W++>+++ N
o? K- w+++>+++++$ O--->---- M->-- V? PS+ PE Y? PGP--- t+(-) 5? X-(++) R*
tv++>! b+ DI+++>++++>+++++ D++ G>+++ e*>+++++ h!(*)>++ r%>$ x+>$
------END GEEK CODE BLOCK------
-
Jul 9th, 2003, 12:25 PM
#4
Originally posted by Programmer_n00b
I thought you could run VBScript client side by using the;
<script type="text/vbscript">
blah blah
</script>
tags
What CornedBee means is that you don't need to. it is fine exactly as it is as javascript. Even Microsoft is getting away from VBScript for web pages.
-
Jul 10th, 2003, 10:39 AM
#5
And no browser beside IE supports it in the first place.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 14th, 2003, 08:49 AM
#6
Addicted Member
that code works pretty well,
i use it myself...if you want to move from vbscript tp javascript or just learn javascript and other web related technologies go
here
One thing that sustains me through life is the conciousness of the immense inferiority of everyone else
--Oscar Wilde
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|