|
-
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------
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
|