Can Javascript Add Items To ASP/VBScript Dictionary Object?
Jul 23, 2005
I got two ASP pages. One is ASP email form (I'm using Persist ASP
Email component). Another one has all file links in it. For example,
when user click Outlook course hyperlink. It will pop up another
window with outlook course PDF file. (All PDF files are already in the
server).
What I am trying to do is: When user click the "Add Email" hyperlink,
it will add that course name and filepath into ASP/VBScript Dictioanry
Object. After the user finish and click "Attach to email" button. All
the files will be attached in the email as an attachment.
Because I am not familar with VBScript. So, can Javascript add items
to ASP Dictionary Object?
The user clicks on the delete icon, and gets a JavaScript client-side popup to confirm that he wants to delete. I am passing this client-side function a contactID.
Then, I want to send the result of this confirm (true|false) to a server-side VBScript function, along with the contactID. The VBScript function will then perform a delete in the database for the specified contactID.
I have seen many examples about sending stuff back and forth between JavaScript and VBScript, between server and client, but all the examples I see are just popping up generic alerts and such. I need to execute some JS on the client side, return a value, and send it to a VBScript function on the server side.
I have some pages with this VBScript code, which obviously does not work in Firefox. How can I convert this to Javascript in order for my web page to work in Firefox ? It basically fills a drop down with a list of dates that a user can select. Code:
I need some help converting this VBScript over to JavaScript so that the calculations will work properly in browsers other than IE.
You can take a look at Turn 2 Design Code: for a feel about what I'm trying to do, but basicly, I just need to calculate the cost of the selected items based on the selected quantity of that item.
The only thing I know about JavaScript is the small Pop-up scripts I've been able to litterally copy and paste to implement. So, please, dont just post code, post an explaination of whats going on and why so I can try to figure it out. Code:
Not sure whether this should go in the JavaScript or VBScript/ASP section, but I'll try here anyway.
I have an ASP include file that contains both VBScript and JavaScript code. The VBScript processes some information and has an onChange event which calls a JavaScript function. Within this javascript function I want to access a recordset and retrieve a value using a variable from the javascript. Here's the code from the JavaScript section. Code:
I'm looking to return DATE ONLY for yesterday's date. No seconds, milliseconds. Formatted either yyyy/mm/dd or mm/dd/yyyy. VB does it so easily Date()-1 will return 03/27/2007 if today is 03/28/2007. Why so many hoops for javascript? Any ideas?
I have the following function to get the total qty:
function calttl() { var ttlqty ttlqty=0 for (i = 0; i <= document.qtymain.orderdetail.length-1; i++) { ttlqty = ttlqty + document.qtymain.qty.item(i).value }
}
The problem I have is the document.qtymain.qty.item(i).value I get look like a string, so the number I get for ttlqty is not add up the number but concatenate.
How do I convert the value I get to a number in javascript?
Can anyone redirect to any online tutorials, articles, code of how to upload a file using HTTP PUT method and JavaScript or VBScript to a server running Apache 2.0 that uses CGI + PERL.
How to create configuration entries in httpd.conf for supporting HTTP PUT method.
How to code with AJAX to post uploaded file content to the server using PUT method ?
Can I use javascript to create a menu. then insert the value to it? I mean.. If i got 1 page, and 1 textbox. can I pass in the value in the textbox to a vbscript Msgbox or Menu, then i change the value in Menu, maybe use combo box or listbox. then i select it and click ok, the value in my page can get it and chage the default value? Thank!
ps: I want a pop up "menu", not a pop up "window"... or maybe in Vb6 we calll a form
I have an object that defines the default color, and then when the color is updated, the different css classes need to be updated as well. So here's what I was trying to do
So problem 1 is I keep getting "undefined" returned for "this.mainColor". If I use colorPicker.mainColor, it hasn't been created yet so it throws an error.Problem two is if I update mainColor from another function, say to make mainColor = "green", then backgroundColor doesn't automatically update.
here's something like an associative array implementation...
/* File: Dictionary.js Version: 1.0 Last modified: 09.17.2002 Author: Alexandar Minkovsky (a_minkovsky@hotmail.com ; URL: http://www24.brinkster.com/alekz) Copyright: Left Type: Class Exports: Dictionary class. Dependencies: None. Description: Similar to ASP "Scripting.Dictionary" Object, or an associative array with somewhat limited functionality. There's a few differences: - "item" property is replaced by two methods getVal and setVal. - "key" property is replaced by the setKey method. As the value of an item can be virtually anything, even another Dictionary object, the Dictionary Class might be usefull. If someone have a suggestion or wants the Dictionary class to be extended some way, feel free to drop me an e-mail. Tested with: IE4; IE5; IE5.5; IE6; NS4.78; NS6.0; NS6.1; NS6.2; NS7.0; Mozilla 1.0; Mozilla 1.1; Opera 6.0 */ /* ================ Dictionary Class ================ - Instanciating oDict = new Dictionary();
- Properties ~ Public (int) count - Number of keys in the Dictionary. Default: 0. Read only, do never manually set this property! ~ Private (Object) Obj - the object actually containing the data. Do never use it directly.
- Methods - look at the function descriptions for detailed explanation. ~ Public (BOOL) exists(sKey) (BOOL) add (sKey,aVal) (BOOL) remove(sKey) (void) removeAll() (Array) values() (Array) keys() (Array) items() (Any) getVal(sKey) (void) setVal(sKey,aVal) (void) setKey(sKey,sNewKey) */ //**************************************** //Dictionary Object //**************************************** /* function: Dictionary Parameters: None Returns: A new Dictionary object. Actions: Constructor. */ function Dictionary(){ //Properties //~Public this.count = 0; //~Private this.Obj = new Object(); //Methods //~Public this.exists = Dictionary_exists; this.add = Dictionary_add; this.remove = Dictionary_remove; this.removeAll = Dictionary_removeAll; this.values = Dictionary_values; this.keys = Dictionary_keys; this.items = Dictionary_items; this.getVal = Dictionary_getVal; this.setVal = Dictionary_setVal; this.setKey = Dictionary_setKey; } //**************************************** //Method implementations //**************************************** /* function: Dictionary_exists implements: Dictionary.exists Parameters: (String) sKey - Key name being looked for. Returns: (BOOL) - true if sKey is found ; false if it is not. Actions: Iterates through all Dictionary keys and checks for sKey. */ function Dictionary_exists(sKey){ return (this.Obj[sKey])?true:false; } //**************************************** /* function: Dictionary_add implements: Dictionary.add Parameters: (String) sKey - Key name to be added. (Any) aVal - Value to be associated with sKey. Returns: (BOOL) - true if sKey is created ; false if it is not (because of a duplicate Key name). Actions: Adds a new Key=Value pair to the Dictionary. */ function Dictionary_add(sKey,aVal){ var K = String(sKey); if(this.exists(K)) return false; this.Obj[K] = aVal; this.count++; return true; } //**************************************** /* function Dictionary_remove implements: Dictionary.remove Parameters: (String) sKey - Key to be removed. Returns: (BOOL) - true if sKey has been removed ; false if it has not (did not exist). Actions: Removes a specified key from the Dictionary. */ function Dictionary_remove(sKey){ var K = String(sKey); if(!this.exists(K)) return false; delete this.Obj[K]; this.count--; return true; } //**************************************** /* function: Dictionary_removeAll implements: Dictionary.removeAll Parameters: None Returns: Nothing Actions: Removes all key=value pairs from a Dictionary object. */ function Dictionary_removeAll(){ for(var key in this.Obj) delete this.Obj[key]; this.count = 0; } //**************************************** /* function: Dictionary_values implements: Dictionary.values Parameters: None Returns: Returns an Array containing all the item values in a Dictionary object. Actions: Iterates through the Dictionary name=value pairs and builds an Array of all values. */ function Dictionary_values(){ var Arr = new Array(); for(var key in this.Obj) Arr[Arr.length] = this.Obj[key]; return Arr; } //**************************************** /* function: Dictionary_keys implements: Dictionary.keys Parameters: None Returns: Returns an Array containing all existing keys in a Dictionary object. Actions: Iterates through the Dictionary name=value pairs and builds an Array of all keys. */ function Dictionary_keys(){ var Arr = new Array(); for(var key in this.Obj) Arr[Arr.length] = key; return Arr; } //**************************************** /* function: Dictionary_items implements: Dictionary.items Parameters: None Returns: Returns a bidimensional Array containing all existing keys=value pairs in a Dictionary object. Actions: - Iterates through the Dictionary key=value pairs and builds a bidimensional Array. - First index contains the key name ; second index contains the value: ex. Arr[0][0] is the key name of the first Dictionary item Arr[0][1] is the value of the first Dictionary item */ function Dictionary_items(){ var Arr = new Array(); for(var key in this.Obj){ var A = new Array(key,this.Obj[key]); Arr[Arr.length] = A; } return Arr; } //**************************************** /* function: Dictionary_getVal implements: Dictionary.getVal Parameters: (String) sKey Returns: Item value for the passed sKey. Actions: Retrieves the Dictionary item value corresponding to sKey. */ function Dictionary_getVal(sKey){ var K = String(sKey); return this.Obj[K]; } //**************************************** /* function: Dictionary_setVal implements: Dictionary.setVal Parameters: (String) sKey (Any) aVal Returns: Nothing. Actions: - Sets the Dictionary item value corresponding to sKey to aVal. - If The key is not found in the dictionary it is created. */ function Dictionary_setVal(sKey,aVal){ var K = String(sKey); if(this.exists(K)) this.Obj[K] = aVal; else this.add(K,aVal); } //**************************************** /* function: Dictionary_setKey implements: Dictionary.setKey Parameters: (String) sKey (String) sNewKey Returns: Nothing. Actions: - Changes sKey to sNewKey - if sKey is not found, creates a new item with key=sNewKey and value=null - if sKey is not found, but sNewKey is found - does nothing. - if sKey and sNewKey both exist - does nothing. */ function Dictionary_setKey(sKey,sNewKey){ var K = String(sKey); var Nk = String(sNewKey); if(this.exists(K)){ if(!this.exists(Nk)){ this.add(Nk,this.getVal(K)); this.remove(K); } } else if(!this.exists(Nk)) this.add(Nk,null); } //****************************************
Alternatively, is there a programming scheme that allows me to assign custom properties/attributes to DOM elements? I can do it with FireFox, but not with IE - it throws an error telling that the given attribute is not supported. Which is strange because AFAIK in JavaScript you can freely modify objects, add attributes and methods on the fly. But it looks like that in IE, HTML DOM elements are not real JavaScript objects.
Its the "To English" bookmarklet as featured on lifehacker (http://lifehacker.com/5168984/to-english-bookmarklet-quickly-easily-translates-any-text-with-one-click).
I've always wanted to help second-language English speakers access my site better, by offering a 'double-click on a word' definition in other languages. I had a useful script for some years which was rather dated, and ceased to work if there was an iframe on the page for some reason. Anyway, I found a very good solution at [URL]However, this opens the definition in a new tab/window.
Having experimented with it opening in a popup, I found problems in getting the popup to regain focus if someone had not closed it before looking for another definition. And anyway, popups can get blocked. So I found a nice layer/iframe solution at [URL] though their positioning of the layer is poor, at least in FF because it slides too far down below the bottom of the page. Their script is: [URL]I have modified that to work with dictionarist and stripped out their own floating part of the script, so that it works with position fixed for everything except IE6. But for IE6, I need to still change this from position fixed to position absolute, and then use a script to float the box.I have been trying the script I use successfully elsewhere in a vaguely similar context:
which has a call to startFloat(); near the end, which is based on their own floating script nearer the top of [URL] which I have removed. (Doubtless the references to Netscape (RIP) can be removed.)
I am doing a distionary page with javascript and I am trying to get it so that the definitions come up when the word they are for is clicked on.
Here is my javascript Javascript Document var filename = "dictionary.js"; function loaded(which){ alert(which + " loaded"); }/**/ function showInfo(which){ var placeholder = document.getElementById("definition"); var source = whichInfo.getAttribute("href"); placeholder.setAttribute(source); alert("showInfo called"); return false; }function prepareList(){ if (!document.getElementsByTagName || !document.getElementById) return false; var words = document.getElementById("words"); if (!words) return false; var links = words.getElementsByTagName("a"); for(var i = 0; i < links.length; i++) { links[i].onclick = function(){ showInfo(this); return false; }} alert("prepare list done"); }function init(){ prepareList(); }loaded(filename); window.onload = init;
Here is my html <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" "[URL]"> <html xmlns="[URL]"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Dictionary DOM Scripting</title> <link href="../styles/main.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="dictionaryScripts/dictionary.js"> </script> </head><body> <div class="page"> <div class="nav"><ul> <li><a href="../home.html">Home</a></li> <li><a href="../form/form.html">Form</a></li> <li><a href="dictionaryCSS.html">Dictionary with CSS</a></li> <li><a href="dictionaryDOM.html">Dictionary with DOM scripting</a></li> <li><a href="discussionPage.html">Discussion</a></li> </ul></div><div class="header"> <h1>Dictionary with DOM Scripting</h1></div> <div class="mainContent"> <div id="words"><h2>L</h2> <p>Click on the word to get a definition</p> <dt><a href="lecturer.html">LECTURER, n.</a></dt> <dt><a href="learning.html">LEARNING, n</a></dt> <dt><a href="liar.html">LIAR, n.</a></dt> <dt><a href="love.html">LOVE, n.</a></dt></div> <div id="definition">Choose a definition</div> </div></div></body></html>
version of Apycom's jQuery menu; you can find itat http://apycom.com/ and it is looking really good.I have uploaded files, and published it on a test site - www.flexin.beUnfortunately, some of the submenus starting from the second that haschildren elements, it adds the item on the top level in InternetExplorer.Does anyone on this list has any experience with this library?
The IE developer toolbar's DOM inspector shows the OBJECT tag and the PARAM tags inside it, and if I don't have the Javascript in an external file, I'll get the "click here to activate" tooltip and the border around what is supposed to be the Flash movie. If I right-click inside the border, I get the Flash context menu. The movie just doesn't load.
<html><head><title>foo</title> <script> function foo() {
var p=document.createElement("param"); p.name="movie"; p.value="flashtest.swf"; AXObject.appendChild(p); var p=document.createElement("param"); p.name="quality"; p.value="high"; AXObject.appendChild(p);
Can I call a value from the database to javascript/vbscript. Let's say the database is called SQL="SELECT * from checkout".Can I validate that the SQL and the javascript/vbscript equals to each other and inside the javascript uses the response.redirect function to another asp page?
From inside a javascript function i need to execute a vbscript sub routine. You might be thinking why i can't do it in javascript. well i probably can but i am better at VBscript and it would be a lot easier.