javascript

Javascript replace hypen with slash

hi, how to replace a hypen (-) with a slash (\) in javascript? for example, i need to replace C-MyDocuments-VisualStudio2008-MyProjects with C\MyDocuments\VisualStudio2008\MyProjects i tried replace function such as variable.replace("-","\") but it showed me error of unterminated string constant i am working in VS 2008 ...

retrieve the hash in the url with php?

someone here in SO told me that the hash (#) in the url could be retrieved by php function parse_url? is this true? my web site got a lot of ajax effects and i want to be able to pass an url with a hash to the index.php so it could display the information based on the hash values. eg. if a user clicks and navigates in my website and he...

Retrieve values from json encoded string.

I am storing a concatenated string like this: echo json_encode($PostedDate.$Places.$Company.$Designation.$ProjectDetails.$DesiredCandidate.$HRName.$HRContact.$Email); I can split this string using JavaScript and store values in an array. But what I want to know is that suppose any of the values above is null, will it affect the array ...

JavaScript getTimeout?

The window.setTimeout (and related setInterval) function in Javascript allows you to schedule a function to be executed sometime in the future: id = setTimeout(function, delay); where "delay" is the number of milliseconds into the future at which you want to have the function called. Before this time elapses, you can cancel the timer...

Javascript slash is missing when called in argument

hi, i am passing a path as an argument in a javascript. for example i am passing a path as c:\my documents\user\aa.jpg when registering javascript in client side. but when calling this in a function say, function js(d) then the slash goes missing..hence the value of 'd' becomes c:mydocumentsuseraa.jpg what to do? thanks ...

CKEditor, how to add a custom button to the toolbar that calls a JavaScript Function

I'd like to add a button to the toolbar that calls a JavaScript function like Tada()? Any ideas on how to add this? ...

Getting information from a Raphael object

I'm using the raphael javascript svg rendering engine. If I use the following code var canvas = Raphael("canvas",700,500); var circ = canvas.circle(30,20,10); some_function(circ); is there any way for some_function to extract the 30, 20 or 10 from the circle object that has been created? ...

Programatically use RGBa values in fillStyle in <canvas> ?

Hi, Posting for the first time here, so if I'm breaking any rules or guidlines here then please let me know gently and I'll keep it in mind for next time... Im learning programming in <canvas>, and I wanted to do a simple thing in it. I wanted to set the RGBa value of the rectangle I was drawing using some variable. for example, var...

Javascript nav dropping down over flash, and not intercepting mouse events.

the nav drops down over flash elements that listen for mouse events. (ROLL_OVER) When the nav is in the down position over the flash, I would like to prevent the flash elements under the nav from receiving rollover. This is not the same issue as the common, js/css nav dropping behind the flash. and Im using swfobject 2, & wmode:"transp...

How to create an on/off switch with Javascript/CSS?

I want to have a sliding switch. On the left would be Off and on the right would be On. When the user toggles the switch, I want the 'slider' portion to slide to the other side and indicate it is off. I could then have a callback that takes as input the state of the toggle switch so I can act accordingly. Any idea how to do this? ...

How can i make these functions use variables for the id? I cant the setTimeout to work when I do.

<script type="text/javascript"> function changeBarAWidth(){ var bar = document.getElementById('firstbar'); bar.style.width = lengthA+"px"; } function increaseBarA(){ if(lengthA < fullBarA){ changeBarAWidth(); lengthA = (lengthA + 2); setTimeout("increaseBa...

Ideas for table row outline on hover? CSS outline fails on tr in Webkit.

I'm trying to build a table (filled with actual tabular data), and get an outline effect for a row on hover. I've tried a couple ideas, but cross-browser issues are holding me back. Would love to hear any ideas. Idea #1: Add CSS outline when hovering over <tr>. Works in IE8 & FF3, but not IE7 or Chrome (Webkit, so probably Safari too...

Facebook like login form

Hello everybody, I've already asked question similar to this some time ago, I thought I solved my problem but now it appears I didn't. Dealing with this problem for some time now and I have absolutely no idea how to do it. The answer I got from previous question works but when I resize the window the password label drifts away when you ...

Printing a java scriptlet variable as if it is a JavaScript variable

hello i need to output a java variable inside a javascript call inside a tag inside a jsp ! for example: <% String param = "hello";%> <dmf:checkbox name="checkbox" onclick = "selectAll(<%=param%>)" /> the javascript generated is: selectAll(<%=param%>),this); but I actually want something like selectAllCheckBoxes(Hello),this);...

Simple example of Javascript good programming style?

I am struggling with Javascript. Most of my problems do not arise from lack of understanding of the language (well, that as well, but bear with me). Instead, the main issue is to understand what is good programming/code organization style. For example, I need to have different entities (forms, text areas, tables, etc.) around in a page,...

how to use a variable instead of a string in <xsl:if test="contains(string, searchedforstring)">

The xsl contains function uses string values... but how can the value of the searchedforstring be assigned dynamically? It should be possible to assign the value of a text entry field in an html form to a variable and use this as the value of the searched for string in the xsl document. The following script snippet gets the value of th...

Sometimes FCKeditor doesn't load in Firefox

I am unable to replicate the problem when I want to but it seems like every now and then, my site using FCKeditor will load the interface but not the content (Clicking the buttons don't do anything). No javascript errors show and once it starts doing it, it usually is tough to get back to normal. The way I found to work best is to click ...

Efficient realtime SVG entity management with javascript

[edit]sigh... the "spam protection" here isn't letting me post the links, so I guess it's URIs instead[/edit] [edit2]ok, BROKEN forms of the URI that can get past the regexp...[/edit2] I'll preface this by saying I'm totally new to SVG, and somewhat new to Javascript, having come from a background in low-level C. On a whim, though, I de...

Is window.location() same as a GET request?

Are cookies preserved while doing windows.location(url), if domain of url is the domain of the current page? ...

How do I mimic access modifiers in JavaScript with the Prototype library?

I've been working with the prototype library for some time now and occasionally find myself wishing I had multiple access levels (public, private, and protected). The closest I've come so far is the following: SampleBase = Class.create({ /* virtual public constructor */ initialize: function(arg1, arg2) { // private ...