function NewDoc() { var oShell oShell = new ActiveXObject ("WScript.Shell"); oShell.Run('cmd /K "C:Test.dot"', 0, false); window.event.cancelBubble = true; return false; } </script> ---------------Script Code Ends-------------
---------------Link Code Starts------------- <a href=":" onclick="return NewDoc()">Create a new document based on C:Test.dot</a> ---------------Link Code Ends--------------
I know to specify the document template name as follows:
---------------Link Code Starts------------- <a href=":" onclick="return NewDoc('C:Test.dot')">Create a new document based on C:Test.dot</a> ---------------Link Code Ends--------------
And change the "Function NewDoc()" in the script code to line to "Function NewDoc(TemplateName)". The problem is that I don't know what syntax to use to parametise the "oShell.Run('cmd /K "C:Test.dot"', 0, false);" line.
I am experience some problems reading a form variable from a Javascript function. The point with this particular variable is that its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried to execute the following line of code:
Error: missing ] in index expression document.frm_1.tx_impexp[exclude][tt_content:159].value=1 --------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position marked...An easy solution would be to change my var syntax but the point is that I cannot since I am using an already made script and I should not modify it.
Just wandering if this is due to a syntax error defined according to Javascript specification language or there is something wrong with this.
I'm passing a variable to a selector. I have found a few resources and tried to implement them but they're just not working for me. I am trying to find href that match my variable and am working with the following:
var itemLink = /site/Mario-Kart..etc. $("a[href=" + itemLink + "]").......etc.
I receive an error "Uncaught Syntax Error unrecognized expression: [href=/site/Mario-Kart..etc. ]" I have been placing the quotes in different places to correct the syntax but to no avail. Also, this works with JQuery v1.44 and earlier but not after.
I'm trying to create a family tree online that has several other related family charts. I want each person's name and birth year to be stored in javascript variables, then I want to be able to just go through the tree, and put the persons name once, and have it put the appropriate name and birthyear in the little boxes that the css is creating.
var johnname = "John Smith"; var johnbirthyear = "Jan 1 1930"; var janename = "Jane Doe";
[code]....
So I thought I had it all figured out. I thought that the above would take the id of John that I added, go to the line that sets the name, add john to the word name, and then document write the variable of johnname from the js file. I know you're laughing at me because of course it instead made the value of name to johnname, then wrote the word johnname in the box. I want to go through and be able to just type the persons name in the html for that box once, and have it update with their appropriate info.
I'm using a form data reference, something like P-1234 for example to create a text file and a link to the file. This is during the construction of a new table or table row with javascript. I have an array of one or more references submitted via form using $_POST. On my action page I am creating a txt file P-1234. If I am creating a table ot table row using createElement(), one of the cells will have a link to the file. If the file is created as follows:
$File = $_POST['ref'][$i] . "txt"; After creating the cell var Cell = document.createElement('td');
[code]....
I assume the link is inserted using innerHTML? If so, do I just append the filename to the end of the file path like this?
I'm trying to build a page that shows random, alternating divs, and have looked at this page as an example. However, the issue at the moment is that although the divs display randomly, they do not disappear in order.The finished "page" is to be referenced by another page that I do not have control over. Here is the section of the file containing JavaScript:
<script type="text/javascript"> var curcontentindex=0 var messages=new Array()
[code]....
I've found very little info on how to reference a previous variable...maybe create an array to store them in, but wasn't sure how to go to the previous value in the array.
Here's my problem: I need to create a variable name dynamically, made up of a string (say "var_name_") and an integer. Ultimately I want something like this:
var_name_1 = 'whatever value I want' var_name_2 = 'whatever value I want' var_name_3 = 'whatever value I want' ... var_name_N = 'whatever value I want'
But the actual variable names are determined at run-time, so I can't just hardcode them.
Any suggestions? JavaScript doesn't seem to have a Variable type, so I can't just cast a string into a var...
I have the code this way in order to consolidate it since I would prefer to do that instead of checking the selected ID and manually checking against all possible IDs (which works flawlessly, it just takes up about 5x the lines and is not modular). What I have above also works, but there is one fatal flaw:
It seems like the anonymous function that is the onclick for each unselected element becomes "return changeTo(tab + '_id')", but I don't want it to be that. I want the argument to actually be what tab is instead of the variable.
What ends up happening is that after changeTo() is called for the first time, any element you click will result in the last element being the selected one, as if it's using the final value of tab as its return value.
This doesn't make any sense, though, since tab is local, and deleting it before the function exists doesn't work. Deleting elem at the end of the for loop doesn't work. I honestly don't understand what's going on or why it doesn't set the new onclick value correctly.
Basically I just want changeTo(tab + '_id'); to turn into changeTo('MYID_id'); instead, but it simply doesn't do that and I can't figure out a way how.
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; And on line 321 I try document.write(www); I've tried so many different options, just won't work. I have even tried to call document.write(window.www);
The code is below.. might be easier to read on [URL] Code: <html><head> <title>Integrated Ad Sample</title> <!-- NOTE MANDATORY jQuery Include --> <script type="text/javascript" src="[URL]"> </script><!-- Integrated Ad Include--> <script type="text/javascript"> .....
I am probably going about this all wrong, but I'm not sure how to do this.Basically I need to create a unique variable name for each element that has the same class name and set each one to zero.I thought I could just concatenate the index value to a variable name to create unique names. Something like:
$('.toggle-trigger').each(function(){ var toggleTriggerIndex = $('.toggle-trigger').index(this); var t + toggleTriggerIndex = 0;
I am working on a javascript for my blackberry. I am trying to capture the latitude and longitude of that phone. I am able to get the coordinates in an alert box but am having a little trouble writing it to a form input field.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]"> <html xmlns="[URL]" xml:lang="en" lang="en"> <head><title>GPS Testing</title> </head><body> <script type="text/javascript"> if(blackberry.location.GPSSupported){ document.write("Your device supports GPS locating"); blackberry.location.onLocationUpdate(window.alert("Latitude: " + blackberry.location.latitude + " Longitude: " + blackberry.location.longitude)); var lat = blackberry.location.latitude(); var lng = blackberry.location.longitude(); blackberry.location.refreshLocation(); document.write(lat); } </script></body></html>
I am only able to test with Blackberry. I was trying to create a couple of variables with the "var lat =" and var lng =". With this script I get the alert window and when I click ok it writes "Your device supports ...".
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
1. Is there anything in the specs/standards that says the <form> and <input> objects must be available for reference in the DOM as soon as they are parsed in the document, so that the script will succeed? I couldn't find anything.
2. If nothing is in the specs/standards, then does anyone know of any browsers which would not make the objects available for script immediately? I'm wondering if, for example, a browser would only make the DOM available to script once it is fully loaded and parsed?
So I'm trying to write this simple little form, where you input values and it calculates something and spits back the answer in a text box. I just started out and this is what I have so far. The problem is, the javascript line I use to change the value of the textbox in order to show the result doesn't work. The value I change it to flashes, and then disappears.
So for example, I hit the "Solve!" button and I see the word "current" in the textbox, but then it just disappears. I'm working in firefox.
<html> <head> <script type="text/javascript"> function calculate() {
I wrote a script to construct chords to make writing music easier for me. The script works, it shows there are no errors, and it does what I want it to do, but the page keeps refreshing almost immediately after the Alert box goes away. I have no idea whats going on. I don't know if it's the JS or the HTML part of the page.
<head> <script> function calc() { var type, note, root, third, fifth, seven, ans; var notess, notesb; [Code]...
I'm using an ajax script that receives a value into an input box and thus performs a function. I need to invoke the function immediately after the input box has a value. Currently the box has to lose focus in order for the function to work.
I have written code that looks like this. The code works great for about a split second and then the page refreshes itself and I am back to square one. How can I prevent the page from refreshing itself and wiping out my jQuery changes. The page I am working on is located here [URL]
THis is very nice effect and more easy to use than the CSS method. I'll use this for some hover states.
Problem is that the opacity starts when the page is loaded. So you see the images 'flash' from normal to 'opacity: 25'.
Is there a method so the images have the opacity value immediatly, instead of when the page is loaded? Like a step before 'document.ready'. Or is the only way, the CSS way?
I'm in the process of building this Ballroom Dancing website that has a simple dropdown menu. The menu works if I immediately call jQuery right above the javascript for the menu, ie:
The problem is that I don't want to do this because I already have WordPress calling jQuery several lines above for some other plugins. Is there a reason why it will only work with jQuery included right above? You can visit the site at www.zumbasudbury.ca to see the non-working dropdown. Hovering over Ballroom should produce a dropdown of two items.