javascript

Borrowing javascript code from one page to inject in another

Alright, let me preface this by saying that I have little programming experience, so I apologize if my explanation belies some serious ignorance. I've always wanted to learn certain tricks but I can never find any tutorials. Here's the deal: There's a website that gives you various science questions and grades the input. For each que...

Smooth fonts with CSS

How can I get smooth fonts? I don't want the edges to look all fuzzy. Hacky solutions are not a problem :) ...

jquery click on link?

After an event is triggered, how do I make jQuery click on a link with an id of mylink? ...

How to upload multiple files in PHP

All the scripts I have found via Google search rely on some sort of screen that first asks the user how many files they need to upload and the upload script works based on that number. But what if I don't want any limits, but want to allow the user to upload as many or as few as they want. How to go about this? All I have for now is th...

jQuery $("*").fadeTo() moves content before fading.

Why does all content get jerked downwards before fading in the following, and how can i fix it? Using FireFox 3.6.3, thanks in advance. <html> <head> <script type="text/javascript" language="javascript" src="http://localhost/javascript/jquery-1.4.2.js"&gt;&lt;/script&gt; <script type="text/javascript" language="javas...

Make div appears if any of the checkbox is checked!

Hello, I am working on dynamic site where multiple checkboxes are there with unique ID, What I want is new <div> to appear if any of the checkbox is checked & disappears if all the checkboxes are unchecked. New to javascripts, need your help. Thanks ...

What's wrong with JavaScript's regular expression notation?

I was reading Douglas Crockford's web page, JavaScript: The World's Most Misunderstood Programming Language, and I couldn't help but notice that, under Design Errors, he mentions "the notation for literal regular expressions." What exactly is he talking about? What's wrong with JavaScript's notation for regular expressions, and why? ...

Select punctuation marks directly adjacent to links, wrap them in spans

Would like to use jQuery to: select any punctuation marks (meaning . , ; : ' " &ldquo; &rdquo; &lsquo; &rsquo; etc.) that occur directly before and after any links and then wrap the punctuation marks in spans. Hence this: <div id="mydiv"> Lorem ipsum <a href="#">dolor sit amet</a>, consectetur &ldquo;<a href="#">adipisicing ...

Problem with printing javascript and html with php

Hi, I have this print statement: print "<a href='#' onClick='document.getElementById(\"myheader\").innerHTML=\"\"'".$rowQuery['keyword']."&nbsp; ·&nbsp;</a>"; Unfortunately, it prints: <a ·&nbsp;="" keyword&nbsp;="" onclick="document.getElementById("myheader").innerHTML=""" href="#"/> I have no idea why, any help would be useful....

link element onload

Is there anyway to listen to the onload event for a <link> element? F.ex: var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = 'styles.css'; link.onload = link.onreadystatechange = function(e) { console.log(e); }; This works for <script> elements, but not <link>. Is there another way? I just need to kn...

Help changing content on the page using both php and javascript

So I am trying to have a dynamic tabs kind of thing using both php and javascript. To make it much easier to understand, remember the two choices on facebook (Recent news and most recent) or something like that, when you click on one of them it just changes the content that you see in the middle without updating the page. i know how to d...

how to create Pert charts made with CSS or javascript

Please every body, How do I create pert chart like this? I want to make with CSS or javascript. thanks a lot http://upload.wikimedia.org/wikipedia/en/4/40/Pert_example_network_diagram.gif ...

How can I store JSON data in a JS variable?

I have an ajax response which is an array passed via php's json_encode() function. Printing it directly to the browser works fine: for(var i=0; response.length; i++){ document.write(response[i].text + '<br />'); } Adding it to a javascript variable throws the error "response[i] is undefined" var str = ''; for(var i=0; response....

Select tag inside hyperlink problem

Hello, I have simplified my page and here what I have: <html> <head> <meta http-equiv="content-type" content="text/plain; charset=utf-8" /> <title>Title</title> <style> a { text-decoration: none; } div select { margin-top: 20px; display: block; } </style> <script type="text/javascript" src="http:...

Safari Extension safari.application error

Hi, I'm making an extension for safari I created a context item with command = showNote In debugger I get the follwing error TypeError: Result of expression 'safari.application' [undefined] is not an object on line 8(the last line) are there any things you need to include or call before this works? main.js function showNote(event){...

Object method gone after obj.prototype = new ParentObj(); in JavaScript

Hi, I am trying inherit objects in JavaScript. Take a look at this example: var BaseObject = function() { }; var ChildObject = function() { }; ChildObject.prototype.childMethod = function() { }; ChildObject.prototype = new BaseObject(); ChildObject.prototype.constructor = ChildObject(); However, as soon as I do prototypal inherita...

How to call a javascript post render in Rails ?

This is the facebox popup content <div class="form_container"> <% form_remote_tag :url => { :action => 'custom', :d=>params[:day], :h=>params[:hour] }, :class => 'general-form', :update => 'grid['+params[:day]+']['+params[:hour]+']', :success => 'handle_success('+params[:day]+','+params[:hour]+')' do -%> <...

Change bg on radio deselect

This is just an add on to my last question. Once I deselect the radio button I need to return the background color to its original state. So the solution we came up with is: $(document).ready(function(){ $('input:radio').change(function(){ $(this).closest('div').toggleClass('highlight'); }); }); Now I need to remove th...

yui-compressor works on one server, not on another?

I'm using YUI compressor jar file to merge and minify a number of JS and CSS files. This works great on my mac, and on my CentOS 5 server. Now I bought another CentOS VPS and the same script is not working on that pc. The minification gets done, but my minified javascript starts throwing errors. When compressing the same files with the...

Need Help Evaluating Javascript From HTML Without WebBrowser

Hello I need help !!! I am trying to evaluate javascript from html page based on HTML (I mean some of the variables in javascript function are using html tag id ) I need to use it multiple threads (Not UI) so this means that i can not use WebBroser. I can not use Eval.JScriptEvaluate because the javascript depends on the html Is t...