Friday, 8 September 2006
|
| fso question. Guest 05:41:08 |
| | a simple question.
how can i get the path of the html that on browser now?
i think default fso path is "c:\document~~\usrname\background".
i noticed relative path "." means there always. doesn't care what html file i see which is
in another path like "c:\test".
i want to get the path the current html is in.
|
| | 5 answers | Add comment |
Thursday, 24 August 2006
|
| JavaScript object destructor method ??? Eli 19:20:14 |
| | Hi,
Is there any way that I can define a destructor for an object in JavaScript that will be called automatically when object is discarded?
<script type="text/javascript"> MyOBJ.prototype=new Object(); MyOBJ.prototype.constructor=MyOBJ; function MyOBJ() { alert('Constructor!'); } MyOBJ.prototype.destructor=function() { alert('Destructor!'); }
var my_obj=new MyOBJ(); //<-- will show 'Constructor!' delete my_obj; //<-- will show 'Destructor!' </script>
-thanks in advance, Eli
|
| | 6 answers | Add comment |
Wednesday, 23 August 2006
|
| javascript submit problem : form won't submit Joop 10:06:28 |
| | Hi all,
I'm kinda new to JavaScript, but hey... I'm trying anyway!
So, here's my problem :
I've created a table in my document, presenting a list of items, one can 'select' by clicking on it... (Kinda like a menu, you make your choice from) But since this table can get very long, I've put something of a 'search-form' on top, which enables the user to make a selection of products from the list.
Now, the form uses a "post" method, and submits to itself, using the form action. Some PHP script will make sure that the form is filled out already, the next time it's presented.
The table, containing a list of products is presented, below the form. When a user clicks on a product, the product should be "selected". At first i just used a <a href="zoeken.php?prod_id=24"> link to do this, but the problem is that my form won't remain in tact.
So now, the global idea is to submit the form after setting a hidden form-field using JavaScript, using a onClick event.
Here's my code :
<-- the script -->
<head> <script language="JavaScript"> <!-- var old_Color;
function select_this(id) { old_Color = document.getElementById(id).style.backgroundColor; document.getElementById(id).style.backgroundColor = '#FFCCCC'; }
function deselect_this(id) { document.getElementById(id).style.backgroundColor = old_Color; }
function submit_this(id) { document.forms['zoeken'].select_id.value = id; document.forms['zoeken'].submit(); } --> </script> </head>
<body>
<-- the form -->
<form name="zoeken" action="zoeken.php" method="post" style="margin: 5px;">
<-- a very long form with a lot of variable goes here -->
<input type="submit" value="Zoeken" class="formulierknop"> <input type="hidden" name="select_id" value="">
</form>
<-- the tablerows, in the table, all look like this -->
<tr id="1" onClick="submit_this(1);" onMouseOver="select_this(1);" onMouseOut="deselect_this(1);" style="cursor: hand; background-color : 'transparent';">
</tr>
Cool huh?!? Everything seems to work, but the submit function. Did I do something terribly wrong?!? I probably did...
WHY WON'T MY FORM SUBMIT WHEN I CLICK ON A TABLE-ROW?!?!?!?!? :-S
Thnx in advance to everyone spending time on this!
|
| | 6 answers | Add comment |
Tuesday, 22 August 2006
|
| IE form.submit() proudces invalid syntax error Bradley Kite 20:38:54 |
| | Hi all.
I'm trying to diagnose/solve a problem with internet explorer, whereby sometimes the form submits, and other times IE produces an 'invalid syntax' error.
First, I have a form, and within the form is a button bar and a <div> block which contains a table of parameters. The div block is used to create a layer.
Now, when the table contains 15 or less rows in it, any button on the button bar which calls form.submit() works as it should, however, where the table has 16 or more rows, the form.submit generates an "invalid syntax" error. IE doesnt provide any more detail on this error.
Mozilla/Netscape works as expected regardless of the number of rows.
I am using IE 6.0.2600.0000 but have also tried on other versions of IE 6 and get the same results.
The code is as follows:
function _runButton() { document.getElementById('count_groups_form').submit(); }
<!-- Extra HTML removed -->
<form action="UpdateCount" method="get" id="count_groups_form" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="edit" value="0"> <input type="hidden" name="new_order" value="0"> <input type="hidden" name="action" value=""> <input type="hidden" name="has_changed" value="0">
<!-- Button Bar --> <table class="button_bar" width="100%"> <tr>
<!-- other buttons removed -->
<td align="right" width="23%"> <input type="button" class="button" name="_run_button" value="Run Count" onClick="_runButton();"> </td> </tr> </table>
<div align="left" class="count_groups" id="count_groups"> <table width="100%" class="without_border">
<!-- actual rows removed -->
</table> </div> </form>
Any help will be much appreciated.
Please reply to kitebr@alchemetrics.co.uk
|
| | 4 answer | Add comment |
Monday, 21 August 2006
|
| finding mouseposition in a layer Nescio 18:55:53 |
| | hello,
i have a script that finds the x and y from the mouse position, this works fine.
but now i have an image in a layer : <div id='someLayer'> <img src='someImage.jpg'> </div>
when people click on the image i want the x and y of the mouse postition relative the the postion of the layer. when the layer has 'top:20px ' and left:20px' and when you click at the left top corner of the image i want x = 0 and y = 0 instead of x = 20 and y = 20;
but how do i do this?
thanks
|
| | 8 answers | Add comment |
Friday, 18 August 2006
|
| document.form.submit() doesn't work for large form fields Alan_atwood 09:56:02 |
| | Hello all. I am having a problem with the submit() method that is driving me nuts. I'm using document.form.submit() with large text fields (approx. 2000 characters) and am getting a "Invalid Syntax" error. If I do the same thing with a text field of under 1500 characters, it works fine.
Is there some size limit here that I don't know about? Haven't been able to find anything so far on this particular problem.
Thanks, Alan
|
| | 2 answer | Add comment |
Monday, 14 August 2006
|
| Compatibility Issue Sev 18:35:20 |
| | I think (a bit clueless I'm afraid) I'm using a form script in the template of this site: www.flywessex.blogspot.com
What I would ideally like to do is get rid of the 'Go!' buttons from the right-hand side drop-down menus, so that the user simply has to select from the list and is taken straight to the selected page.
I tried a script but it only worked in IE, not Firefox. I've been told that it just cannot be done AND be compatible with both browsers. I refuse to give up just yet and thought I'd ask you guys before making my mind up.
Any help greatly appreciated.
Cheers,
P.
|
| | 30 answers | Add comment |
|
| json Zoe Brown 15:48:20 |
| | Hello
I am looking for a good reference for JSON (javascript object notation) i have to write a menu structure and I quite fancy doing this using json. The menus will be quite dynamic and I cant think of any other way to do them.
Zoe
|
| | 3 answer | Add comment |
|
| Can Java Script allow me to calculate a future date? Guest 09:20:53 |
| | Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a letter. Can I use javascripting to create a webpage to allow a user to enter a letter and then click a button to find a future calendar date? I'm just not sure how much user interaction scripting allows. Does java scripting allow buttons, textfields and the ability to put enough smarts in to calculate a future date?
|
| | 5 answers | Add comment |
|
| Javascript and Microsoft Windows Peter Olcott 09:01:17 |
| | Does JavaScript represent its controls internally as Microsoft Windows controls, or does it build them from scratch like Java?
|
| | 2 answer | Add comment |
|
| JavaScript Error Calling Webservice Zeez 06:14:22 |
| | Hi all,
I have a webpage that calls a webservice found on a remote computer. Below is the code of my webpage:
===================================== <html> <head> <script language="JavaScript"> var iCallID;
function init() { service.useService("http://www.webservicex.net/length.asmx?WSDL","MyMath");
iCallID = service.MyMath.callService(onWSresult, "ChangeLengthUnit", 12, "Feet", "Inches"); }
function onWSresult(result) { alert(result.value); if((event.result.error)&&(iCallID==event.result.id)) { var xfaultcode = event.result.errorDetail.code; var xfaultstring = event.result.errorDetail.string; var xfaultsoap = event.result.errorDetail.raw;
// Add code to output error information here } else { alert("The method returned the result : " + event.result.value); } } </script> </head> <body onload="init()"> <div id="service" style="behavior:url(webservice.htc)"> </div> </body> </html>
=====================================
When the "alert(result.value)" is reached, I used to get "undefined" as a result but now it seems that the webpage freezes and nothing happens. I'm sure that the webservice I'm calling is functioning properly (if I type its URL in a brower, it works fine) and I'm sure that the 'webservice.htc' is there in it's proper location.
Note: The above webpage is hosted on a Windows 2003 Server which has a public IP (i don't know if this might be helpful)
Any ideas would be greatly appreciated!
Thanks
|
| | 2 answer | Add comment |
|
| How to apply a work explain for all document? Cylix 05:13:43 |
| | In my site, There will be some word shold have explaination. The explaination will be shown in a layer(<div>).
How can I add only a JS file to set all the word in every document? Is it using regular expression and replace the body.innerHTML with the word to onclick event? Any better way?
Thank you.
|
| | Add comment |
|
| Finding line numbers of HTML elements E271828 05:06:13 |
| | Hi,
I'm helping to work a developer tool that verifies a given HTML element has a given attribute (e.g., that all LABEL elements have a FOR attribute, all INPUT elements have an ID attribute, etc.). Pretty much all of the functionality is working except a feature that shows in which line of the HTML source a violation of the user-set rule occurs (e.g., where a LABEL element doesn't have a FOR attribute). There doesn't seem to be a straightforward way with Javascript to find out at which line a piece of a page's HTML code is, so I've been reading through the XBL/XPCOM source code of Mozilla Firefox's Javascript Console for some insight. While I'm slowly making progress with that method, I was wondering if I haven't overlooked some way to do what I want with Javascript. Has anyone dealt with this kind of problem?
Thanks, Eric
|
| | 1 answer | Add comment |
|
| editable combo-box Henry 04:42:53 |
| | Hi all,
Can anyone please recommend me a good and easy-to-use editable combo-box? I found several:
1) http://particletree.com/features/upgrade-your-select-element-to-a-combo-box/ 2) http://webdeveloper.earthweb.com/repository/javascripts/2004/10/609371/pp_editable_dropdown.html
Both of them are superb but I met with problem while trying to used them in my scripts. Can anyone pls recommend me a much simpler one?
Thanks very much.
|
| | Add comment |
|
| retrieve current index while looping an array Motion Musso Aka: Sathia 04:13:14 |
| | this is it, how can i get the current index? couldn't figure it out.
thank you
for(i=0;myarray.length<i;i++){ do_something(); //i need the current myarray[index] }
bye bye
-- una volta qui era tutto <table>
|
| | 11 answers | Add comment |
|
| complex-syntax question...;) Maya 03:22:54 |
| | I'm trying to implement a drag-n-drop script, found here.. http://cwdjr.net/test/newDrag.html
but it doesn't work quite the way I want it to (div to drag-n-drop moves down the window when I first click on it..)
I'm having a hard time dealing with the code because I don't understand some things about it..
first of all, in this script the function that does the drag-n-drop is called thus:
return dragImg(this,event)
but function is declared thus:
function dragImg(div,evt,how) {
what is the 'how' for ?? it's not passed to function from function call.. if I take it out from function declaration get error that 'how' is undefined, but where IS it defined in this script (I mean what does it evaluate to before code inside function starts running (I tested with an alert in first line of function, it prints 'undefined', so I really don't get this...)
also can someone pls explain syntax of these var declarations? (rather, they're var initializations, right?)
how = how || "relative";
var mx = evt.pageX || evt.clientX + root.scrollLeft;
I've never seen vars initialized like this in JS (or any other language for that matter) and can't look this up because don't even know what to search for....
thank you very much...
|
| | 2 answer | Add comment |
|
| FAQ Topic - How do I protect my javascript code? FAQ server 03:00:01 |
| | ----------------------------------------------------------------------- FAQ Topic - How do I protect my javascript code? -----------------------------------------------------------------------
In the main, you can't as your code is distributed in source form and is easily readable. With JScript, there is the Script Encoder (see MSDN), but this is nothing more than obfuscation. Disabling the right mouse button also does nothing to protect your script in a Web browser.
Your code is likely protected under copyright laws. See:
http://www.wipo.int/about-ip/en/copyright.html
http://webdesign.about.com/msubcopyright.htm
=== Postings such as this are automatically sent once a day. Their goal is to answer repeated questions, and to offer the content to the community for continuous evaluation/improvement. The complete comp.lang.javascript FAQ is at http://www.jibbering.com/faq/. The FAQ workers are a group of volunteers.
|
| | Add comment |
|
| drag-n-drop Maya 00:22:28 |
| | I need a drag-n-drop script.. I have found one here.. http://javascript.internet.com/page-details/drag-n-drop.html
each div containing an image has an id, and each image has a name, as in
<div id="h" style="position:absolute;left:100;top:350;"> <img src=http://javascript.internet.com/img/cards/hearts.gif name="h"> </div>
but I don't see where he references these id's and names in the JS code..
functions are declared with param 'e', but I don't see this param being passed to the functions when they're called (called thus: document.onmousedown = MD;.. etc..)
I need to apply this to a div (which contains a table), but if I put the same id and name to my <div> as he has here for one of the images it doesn't work..
what am I missing please.. thank you..
|
| | 8 answers | Add comment |
Sunday, 13 August 2006
|
| Custom web-based media player Hector 22:31:57 |
| | Hi,
I've presented my audio files on the web in mp3 format (to be played online). Can I have a custom media player on my html page? I mean using
my own image-buttons for basic functions like Play, Pause and Stop.
Thanks, Hector
|
| | 2 answer | Add comment |
|
| Populate input fields on a web form Ero 21:44:29 |
| | Is it possible to input values into a web form from an external source like a client-side javascript?
There is a web site that I'm viewing where I have to enter 5 values in the form. 4 of the values don't change only one input field does. Is it possible to create a javascript to run which would popluate the non-changing values by executing the script or by pressing a button on the script?
No experience at this so any examples would be helpful.
Thanks
|
| | 7 answers | Add comment |
|
| IDE for JavaScript. Georgi Naumov 20:45:32 |
| | What IDE you are using for JavaScript? Do you pleased? Sorry for my bad english. I use Scite because it's free and open source. But searching for sometnig with good intelisince.
|
| | 4 answer | Add comment |
|
| Nested quotation marks/single quotes problem Dustin 20:02:07 |
| | I have a nested quotes issue I'm trying to resolve. Basically I need a 5th level nested quote for quoting the string argument to the getXMLFeed() function in the following:
var myHTML = "<TR onMouseOver='return overlib(\"<A HREF=\'javascript:void(0)\' onClick=\'javascript:getXMLFeed(\"price\")\'>Price</A>\"'>";
How do you do a 5th level nested quote?
Level 1: " Level 2: ' Level 3: \" Level 4: \' Level 5: ?!?!?
Thanks, Dustin
|
| | 2 answer | Add comment |
|
| Alert! Terrorists use Javascript to write deadly virus programs !!! Hans-Marc Olsen 18:54:55 |
| | If you encounter the deadly Al Qaeda Java Script code, your hard disk will be formatted and your CD drive will decapitate you with a CD spinning at high speed shot at you !
Very dangerous !
So if you see towelheads writing something on computers, shoot them , because they are terrorists !
|
| | 1 answer | Add comment |
|
| Cross Domain Scripting with Friendly Domains Jacob JKW 17:53:50 |
| | Having read the CLJ FAQ and having done extensive Googling, I do understand that in in general cross-domain iframe scripting is not permitted. One issue I have not seen directly addressed, however, is scripting across different but still "friendly" domains.
Essentially I'd like to send a signal from the child to the parent in any form at all. I would think that there might exist a way to set some variable or object property that could both be read by the parent and written to by the child (or vice versa).
Am I just totally wrong?
Thanks, Jacob.
|
| | 4 answer | Add comment |
|
| number of times a character occurs in a string Libsfan01 17:38:01 |
| | hi all
how do u get js to work out the number of times a given char occurs in a given string?
regards
Marc
|
| | 7 answers | Add comment |
|