|
John Kuhn wrote:
if you define a function or sub with multiple parameters, and fail to pass one or more, does it error out at runtime?
Unfortunatelly it throws an error on runtime...
I have been spending 3 days to try and find a way to overcome this VBscript limitation and the only solution that is feasible is the ARRAY solution.
Thank you anyway...
theJazzyBrain
Excelence is not an act, but a habbit Aristotle
|
|
|
|
|
I am using geocities to host my website, they offer an HTML editor. What I am trying to do is find out what OS the user is running, and load the page accordingly. In code it would look something like this:
if the user is running Windows XP
{
Set the web page text to "You are running XP";
{
else
{
Set the web page text to "Your are not running Windows XP";
}
how would I go about doing this? Any help is appreciated
-Dev578
|
|
|
|
|
To the best of my knowledge, no. The best you can do is determine that they are running "Win32", which is exposed in JavaScript as navigator.platform :
<!-- details omitted... -->
function window_onload() {
window.alert(navigator.platform)
}
<!-- details omitted... -->
<body onload="return window_onload()">
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
U can use Server object in ASp. It will provide u full information about what O.S. is running,Ur System Configuration and other system information. So try to find out the solution by using Server Object.
|
|
|
|
|
The previous, anonymous post would be correct, assuming you have the ability to write server-side code in something (PHP,ASP,ASP.NET,etc); however, given your example, I assumed that you don't have that capability, and are limited to JavaScript.
It might be feasible to do something with a Java Applet, but of course, that only works for users of your site with Java Runtime Environment installed.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
I'm at the stage where I'm testing out my form. Everything works (error validation, sending data, sending auto reply) except sometimes it doesn't want to save the values of my radio buttons and textboxes. Should I be requesting those variables a different way? Please advise. Here's the form - http://www.csudh.edu/mcnair/application.asp
Gracias,
Donna
|
|
|
|
|
Donna,
Are you saying that it doesn't retain the values of the radio buttons when you post the form, and that you cannot access the values using Request(item) or Request.Form(item) ? Or that you post the form and expect to see the values subsequent page displays?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Basically, my radio and text box values aren't kept whenever I get an error on my form. Yet, when I fill out my form completely, it works fine - goes to thank you page and sends me my data via email. I could send you my code if that helps.
|
|
|
|
|
I am assuming from the URL that you listed that you are using "classic" ASP -- ASP 2.0 or 3.0; this was one of the tragic flaws of form handling with ASP. ASP does not, by default, retain any state for the values a visitor enters in form fields on an HTML form. However, there is hope -- several folks have written things, like this one[^] that will assist with retaining the state of form controls on subsequent round trips.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Donna,
Overall, I must say you've produced very nice, clean ASP code, which is a hard thing to do, considering most people's propensity to write spaghetti ASP code...
So, only two observations:
1) To create the radio groups, both initially and on subsequent postbacks, I'd use a helper function, like this:
<%
Function WriteRadioGroup(Name, Items, selectedItem)
' By the way, I wrote this at warp speed, without actually running to check it
Dim i, strChecked
For i = 1 To UBound(Items)
If Items(i-1) = selectedItem Then
strChecked = " checked"
Else
strChecked = ""
End If
Response.Write("<input type=""radio"" name="" & Name & "" value="" & Items(i-1) & """ & strChecked & ">")
Next
End Function
%>
For this method to work, you'll have to declare arrays up top for the radio button groups:
<%
Dim aYearLevel(3)
aYearLevel(1) = "Sophomore"
aYearLevel(2) = "Junior"
aYearLevel(1) = "Senior"
%>
Then, in-line with the HTML:
<% WriteRadioGroup("sYearLevel", aYearLevel, sYearLevel) %>
That way, when the group is created, it checks to see if the value of a button in the group should be checked or not, and writes the appropriate attribute to the correct item, in this case the attribute of "checked"
On the text areas, I think all you need to do is to stick the value in between the TEXTAREA tags:
<TEXTAREA NAME="sFieldStudy" VALUE="" COLS=40 ROWS=8><% =(sFieldStudy) %></TEXTAREA>
and those values will show up on subsequent page displays as well.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
In my application, one of the form enables end user to upload files.On web server side I am doing HTTP uplad.So far so good accept since "Network Service" account does that for me on IIS 6.0 (IIS 6.0 uses this inbuilt account - for newbies).Instead inbuilt account I would like to have seperate account do that for me.So I will have one account with read/write permission that I can use for upload.Can I run one form that enables upload to run under one say windows integrated account?
Can I do <"Identity Impersonate=true Username=abcd Password =pqrs> just for single form ? Any ideas.
Does any one know if I should be concern about giving "Network Services" account Read/Modify/Write access to harddrive ?
|
|
|
|
|
You can place that form in a separate directory with a separate web.config using the impersonation for parts of the application in that directory.
It might be possible to temporarily impersonate an account, using a method outlined here[^]. If you get that to work out, let me know...
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Also, I would stick with impersonating a unique account created specifically for this purpose, or using the ASPNET worker process account and giving the account only the permission it needs, and only for a particular directory. Do not grant other accounts (Administrator, Run As Service) permission under your web application, as those kinds of accounts can be exploited, leaving your web application, your server, your network vulnerable to more kinds of attacks.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
I can't seem to understand why IE 6 and Netscape 7 render a specific page of mine differently. I have an unordered list within a table division and everything looks OK except for when the list ends. In Netscape there is no extra "space" added to the end of the list whereas in IE6 it adds an extra line (blank of course) like padding.
Is this normal behavior of IE? I can get rid of it by omitting the tag but I definetely don't want to do this. Can I overcome this w/ CSS somehow?
|
|
|
|
|
I've tried and tried to do this successfully. The most I ever achieved was to set the blocking around a UL to zero at the top and zero at the bottom, but then wherever I used this, I ended up adding extra BR's and P's anyway. If someone else has a great solution to this, please let me know, too?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Have you tried to set the margin-bottom style to -20px say?...
theJazzyBrain
Excelence is not an act, but a habbit Aristotle
|
|
|
|
|
Does anybody know a program that will turn the .txt file IIS made into a certificate (.cer). In other words sign it.
and I already tried openssl, and it dosn't work for me....
/\ |_ E X E GG
|
|
|
|
|
nevermind. server 2003 has a tool to do it.
anyone want a ssl certificate from the Alex Egg CA???
/\ |_ E X E GG
|
|
|
|
|
Sure! But do you think the browsers of the world are going to fall for it?
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
Hi,
I'm calling for some script which displays info according to category.
This is how i do it :
<!--#include virtual="/cgi-bin/info_by_category.pl"-->
It works , but currently it always displays the same default category.
Now , the problem : I dont know what category i gonna use. It comes through URL , because the URL looks like this :
www.mydomain.com/info.html?category=1
where the number "1" can be any number from 0-9.
The perl script cant retrieve this info through
$ENV{'QUERY_STRING'}
because i call the script without any parameters.
I'd like somehow to add category number when calling
the script IN RUNTIME (!)
<!--#include virtual="/cgi-bin/info_by_category.pl?category=x"-->
where the "x" is category number passed in URL ,
but dont know if its possible.
Help needed!
Thanks in advance
I tried adding it with JavaScript but id didnt work out ;(
|
|
|
|
|
Why use SSI at all if you have perl at your disposal?
You're really using the wrong tool for the job here. SSI is really intended for adding simple dynamic information (e.g. dates, hit counters, document modification dates, etc.). It's support for variables, conditionals, and dynamic string manipulation (which you apparently need) are very limited if they exist at all.
It seems to me that the only way to do what you want is to dynamically load your page that contains the SSI. At that point, it seems just silly to be using SSI at all. PHP or Perl itself would be much more capable to do what you want.
Here's a couple of questions that may help if you're insistent on using SSI:
1. Where are you obtaining the category id from. Is it just hard coded in a hyper link? If so, then why not just make your hyperlink point the cgi itself passing the appropriate id directly?
2. Can you use perl or php along with SSI? If so, to do what you want would be as simple as:
<?php
$categoryID = $HTTP_GET_VARS["category"];
echo "<!-- #include virtual=\"/cgi-bin/info_by_category.pl?category=$categoryID\"-->\n";
?>
3. Can you get rid of SSI altogether? If so, just move your perl script code into a CGI that draws everything you need and then runs the info_by_category.pl code. The url would then just be:
<a href="/cgi-bin/info_by_category.cgi?category=1">Info</a>
Let me know if you need any clarification.
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Matt, thanks for your reply.You're right - capabilities of SSI are very limited , but i still successed to do what i wanted
Here's how i do it :
|
|
|
|
|
I would like to write an article on this!!! But for now I'll just post the code I Built!!!
I have noticed those flashy sliding menu's??? (some problem with timing)
The html to describe the menu's initial positions
<code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>
</title>
<style type="text/css">
a.menulink {
color: white;
font: bold 16pt sans-serif;
}
a.tab {
color: white;
font: bold 16pt sans-serif;
background-color:yellow;
text-justify: center;
border-style: solid ;
border-color: black ;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
border-bottom-width:1px;
}
</style>
</head>
<body >
<div id="menu1" style="position:absolute; left:151px; top:-135px; width:98px; height:180px; color: white ; background: red; visibility: hidden; " onmouseover="onLower('menu1');" onmouseout=" checkOutMenuArea('menu1')">
<p style="text-align: center; " >
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 1</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 2</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 3</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 4</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 5</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'"> link 6</a><br/>
menu 1
</p>
</div>
<div id="menu2" style="position:absolute; left:251px; top:-135px; width:98px; height:180px; color: white ; background: red; visibility: hidden; " onmouseover="onLower('menu2');" onmouseout=" checkOutMenuArea('menu2')">
<p style="text-align: center; " >
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 1</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 2</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 3</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 4</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 5</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 6</a><br/>
menu 2
</p>
</div>
<div id="menu3" style="position:absolute; left:351px; top:-135px; width:98px; height:180px; color: white ; background: red; visibility: hidden; " onmouseover="onLower('menu3');" onmouseout=" checkOutMenuArea('menu3')">
<p style="text-align: center; " >
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 1</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 2</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 3</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 4</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 5</a><br/>
<a class ="menulink" href="javascript:;" onclick="alert('not implemented');" onmouseover="this.style.color='black'" onmouseout="this.style.color='white'" > link 6</a><br/>
menu 3
</p>
</div>
<script type="text/javascript" src="menu85.js"> </script>
<script type="text/javascript" > initialiseMenuDetails("menu1:menu2:menu3",3); </script>
<a class="tab" style="position:absolute; left:151px; top:20px; width:96px; height:18px;" href="" onmouseover="onLower('menu1')" onmouseout="checkOutBottomLink('menu1')" >menu1</a><br/>
<a class="tab" style="position:absolute; left:251px; top:20px; width:96px; height:18px;" href="link" onmouseover="onLower('menu2')" onmouseout="checkOutBottomLink('menu2')" >menu2</a><br/>
<a class="tab" style="position:absolute; left:351px; top:20px; width:96px; height:18px;" href="link" onmouseover="onLower('menu3')" onmouseout="checkOutBottomLink('menu3')" >menu3</a><br/>
</body>
</html></code>
The javascript (saved as menu85.js in above html)
<code>// SLIDING MENU FOR EXPLORER ©2004 Jason Morley.. Please Distribute and use it, but do not alter!!! email me at JASON.MORLEY@STUDENT.SHU.AC.UK with suggestions yes I haven't fully cleaned this code up.
var missed=false;
var killInterval=false;
var interval=false;
var moveInterval;
var clip=200;
var initialMenuDetails,numMenu;
var menuState;
var timeToDrop=.25; // The time for the menu to slide goes here (assuming the pc can handle it)
var stepsToDrop=10;
function initialiseMenuDetails(strMenuIDNames,menuTabs) {
numMenu=menuTabs;
dropInterval=new Array(numMenu);
raiseInterval=new Array(numMenu);
fIPD=new Array(numMenu);
fIPR=new Array(numMenu);
initialMenuDetails=new Array(numMenu); //this array stores the initial information for each menu.
menuState= new Array(numMenu); // this array stores the menu's current state 0 closed 1 open 2 drop 3 raising
var tArray=strMenuIDNames.split(":");
for (var x=0;x<numMenu;x++){
menuState[x]=0; // menu currently closed
initialMenuDetails[x]=new Array(10);
initialMenuDetails[x][0]=tArray[x]; // Id
menuElement= document.all[tArray[x]];
initialMenuDetails[x][1]=menuElement.style.posTop;
initialMenuDetails[x][2]=menuElement.style.posBottom;
initialMenuDetails[x][3]=menuElement.style.posLeft;
initialMenuDetails[x][4]=menuElement.style.posRight;
initialMenuDetails[x][5]=menuElement.style.posWidth;
initialMenuDetails[x][6]=menuElement.style.posHeight;
}
}
function getArrayRef (menuId) {
for (var x=0;x<numMenu;x++){
if (initialMenuDetails[x][0]==menuId)
return x;
}
}
function getState(menuId) {
for (var x=0;x<numMenu;x++){
if (initialMenuDetails[x][0]==menuId)
return menuState[x];
}
}
function getStateArr(arrNo){
return menuState[arrNo];
}
function setState(menuId,state) {
for (var x=0;x<numMenu;x++){
if (initialMenuDetails[x][0]==menuId)
{
menuState[x]=state;
return;
}
}
}
function onLower(menuId){
arrRef=getArrayRef (menuId);
if (getState(menuId)!=1)
if (getState(menuId)!=2)
{
for (var x=0;x<numMenu;x++){
if (menuState[x]!=0)
{
menuState[x]=3;
}
}
setState(menuId,2);
if (interval==false){
interval=true;
moveInterval=setInterval("moveMenu()",timeToDrop/stepsToDrop*1000);
}
}
else {missed=true;}
}
function onRaise(menuId){
arrRef=getArrayRef (menuId); if (getState(menuId)!=3||getState(menuId)!=0){
setState(menuId,3);
if (interval==false) {
interval=true;
moveInterval=setInterval("moveMenu()",timeToDrop/stepsToDrop*1000);
}
else {
missed=true;
}
}
}
function moveMenu() {
interval=true;
if (killInterval==true&&missed==false)
{
clearInterval(moveInterval);
killInterval=false;
interval=false;
return;
}
for (var x=0;x<numMenu;x++){
if (menuState[x]==2)
{
lower(initialMenuDetails[x][0]);
}
if (menuState[x]==3)
{
raise(initialMenuDetails[x][0]);
}
}
var kill=true;
for (var x=0;x<numMenu;x++){
if (menuState[x]==2||menuState[x]==3) { kill=false;}
}
if (kill==true&&missed==false) { killInterval=true;}
if (missed==true) { killInterval=false; }
missed=false;
}
function lower(menuId){
var menuElement = document.all[menuId];
var ary=getArrayRef(menuId);
var lowerBy= (initialMenuDetails [ary][6])/stepsToDrop;
var clip=initialMenuDetails [ary][6]-((menuElement.style.posTop+lowerBy)-initialMenuDetails [ary][1]);
if (0<=clip) {
menuElement.style.posTop+=lowerBy;
menuElement.style.clip='rect('+clip+' auto auto auto)';
menuElement.style.visibility="visible";
}
else {
setState(menuId,1);
}
}
function raise(menuId) {
arrRef=getArrayRef (menuId);
var menuElement = document.all[menuId];
var ary=getArrayRef(menuId);
var raiseBy= (initialMenuDetails [ary][6])/stepsToDrop;
var clip=initialMenuDetails [ary][6]-((menuElement.style.posTop-raiseBy)-initialMenuDetails [ary][1]);
if (clip<=initialMenuDetails [ary][6]) {
menuElement.style.clip='rect('+clip+' auto auto auto)'
menuElement.style.posTop-=raiseBy;
menuElement.style.visibility="visible";
}
else {
setState(menuId,0);
menuElement.style.visibility="hidden";
}
}
function checkOutMenuArea(menuId){
var ary=getArrayRef(menuId);
var menuElement = document.all[menuId];
mousePosX=window.event.x;
mousePosY=window.event.y;
if (mousePosX>(menuElement.style.posLeft+2)&&mousePosX<(menuElement.style.posLeft+initialMenuDetails[ary][5]-2)&&mousePosY>(menuElement.style.posTop)&&mousePosY<(menuElement.style.posTop+initialMenuDetails [ary][6]))
{ onLower(menuId); return;}
onRaise(menuId);
}
function checkOutBottomLink(menuId){
var ary=getArrayRef(menuId);
mousePosX=window.event.x;
mousePosY=window.event.y;
var menuElement = document.all[menuId];
if (mousePosY>(initialMenuDetails [ary][6]+initialMenuDetails [ary][1]))
{ return;}
onRaise(menuId); return;
}</code>
|
|
|
|
|
I am developing a real estate website. Now on the site are 4 combo boxes. It starts off with a province combo box. When a user selects a province, all the regions for that province are loaded into another combo box, and then if a region is selected, all areas for this region is loaded into another combobox. I do this by making a trip to the server everytime a selection is made. The form is submitted to itself (registration.asp). This works perfectly.
My problem starts as soon as when I want to validat the fields and submit the data to another page. I can't because I am already submitting the form to itself (registration.asp). How do I trigger the javascript function when the submit button is clicked and when all fields are filled in submit it to another page, eg test.asp. Here I will retrieve and use the values. I would like to send my code so that you can look at it, not very complicated code.
Please return ASAP!
Thanks
|
|
|
|
|
Handle the OnSubmit event of the form
in the handler set form's action to "test.asp"
|
|
|
|
|