I am trying to wrap some words with HTML tags, for that I am using regular expressions. I am almost there:
This is my regexp
/((apple|banana|cherry|orange)\b\s?)+/gi
and this is my replacement:
<em>$&</em>
which works perfectly for my example text:
Apple Banana apple cherry, Cherry orange and Oranges Apple, Banana
the result be...
Hey there! Sorry, but for some reason my call to each() always fails, and "this[0].innerHTML is undefined" shows up in fire bug. The code isn't particularly complicated and it seems to follow all the examples I've seen so far.
Would anybody have an idea as to why this would fail?
$("#theirItems tbody tr").each(function(i){
var ...
Hello guys,
I have a simple pagination script.
When you click the "next" button multiple times in a short period of time, the browser highlights the clickable area. All browsers do this to an element that you click repeatedly.
Is there a way to disable the highlighting of that element?
I feel like I've looked everwhere and cannot fin...
Been using Javascript libraries like Prototype and jQuery for development, for a while now. While its a boon using those libraries, the one downside is that using such libraries probably doesn't help in understanding what happens under the hood.
So how does one master DOM?
Will understanding DOM be of more help when using Javascript...
I am trying to call a function within a function. Here is the code
var d = function() {
s: function() {
alert('cool');
}
} ();
d.s();
This does not work. What am I doing wrong
...
How do I programmatically open the "View Source" window (using some Javascript) like when I right click in the browser and click "View Source"? Is this possible?
...
Hello,
Is there a way to get a position/coordinates on mouse click? In example if I have an image in a container and I click on it I want to get coordinates(x,y) in that image? I see only 1 solution to make lots of containers on top of image so small(will be like grid) that when I click it will give containers position in js, but I thin...
Is it cross-browser to catch the mouse coordinates relative to a div box with this:
pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("thebox").offsetLeft;
pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("thebox").offsetTop;
...
Hi guys,
I need an easy to use javascript gridview.
The main feature why I don't use ASP.Net GridView is, that I must update it by javascript.
I google hundrets of them, but don't wanna test them all, so I like tot have good ideas from experience users.
...
i have made a session variable Session["Background1"] = value; in one of my code behind function i want to retrieve this value in my javascript function.
...
I have a form on my main page (main.html) with the target set to an iframe on that page. The action of the frame on the main page is a php file.
So, the php file displays in the iframe basically.
Now, I have this script in the php file to get height of content:
var x = document.body.scrollHeight;
window.parent.document.getelementbyid("...
I am looking for a solution for a client who has a drawing tablet (an input device that simulates mouse movements using a pen) attached to her computer to directly "draw" on an area on a web page. I will then need the results send to a server side script, PHP in my case.
Essentially, this would be a simple mouse drawing canvas with the...
Hiya
Not really much of a JS man - so can anyone explain why this isn't working? I want to call a predefined function in one script from my simple AJAX script - I just want it to call the qtip functionality upon the contents of the div brought into the page via AJAX.
Thanks,
H
SCript 1 - AJAX loader
if(myHttpRequest.readyStat...
Could you please explain how the text in the textarea gets styled in rich-text editors? I've tried to style text in the form but it doesn't change.
Is it JS that recognizes characters typed by the user? How's that done?
Edit:
After a bit of research (Google rules!), I've found some excellent information. For others who might be inte...
This code is giving me error on line 10 in IE6. That is, var ref = ...;
What is the error here?
<html>
<head>
<title>JavaScript Popup Example 3</title>
</head>
<SCRIPT language="JavaScript1.2">
function MyClass()
{
this.OpenWindow = function()
{
var ref = window.open ("http://www.google.com", "mywindow", "location=1,statu...
You guys already helped me on correctly parsing the REL attribute on A tags, but there are two XFN values that I'm not able to match:
"co-worker" and "co-resident". The hyphen causes an error with jquery.
I tried this
xfn_co-worker = $("a[rel~='co-worker']").length;
and this
xfn_co-worker = $("a[rel~='co\-worker']").length;
In bot...
The documentation page for the YUI "Get" utility says:
Get Utility is ideal for loading your
own scripts or CSS progressively
(lazy-loading) or for retrieving
cross-domain JSON data from sources in
which you have total trust.
...but doesn't have any actual examples for how to do so. Their one example doesn't actually reque...
It certainly runs on IE6.
Why doesn't this JavaScript run in Mozilla Firefox?
<html>
<head>
<title>JavaScript Popup Example 3</title>
</head>
<SCRIPT language="JavaScript1.2">
function MyClass()
{
this.OpenWindow = function()
{
var r = window.open ('', 'mywindow', 'location=1,status=1,scrollbars=1,width=100,height=100'...
Hello,
I am working on a one page website that allows the users to add and remove pages from there navigation as and when they would like too, the way it works is that if the click 'Blog' on the main nav a 'Blog' section should appear on the page, if they then click 'News' the 'News' section should also be visible, however the way I ha...
I am using the code below to send an ID to my page:
The image names will always look like this
12.jpg
12-1.jpg
12-2.jpg
12-3.jpg e.t.c
I need to alter the line below so it will only send the 12 not the -1,-2,-3 e.t.c My code below already removes the .jpg part
var id = $(this).attr('src').split('/').pop().replace('.jpg','');
...