RegExp To Alter An Element Name?

Jul 23, 2005

Given a string like:

<input type="button" name="b1" value="Button">

I want to locate the element's name (b1) and replace it with this very name
+ some spice.

And of course it can be any kind of loose HTML syntacs:

name="b1"
NAME="b1"
name='b1'
NAME=b1
....

So it's something like (totally wrong expression, I know):

/name=(s+|'|")(name)/$1+my_spice/i

But I did not work with regexp for a longest time, and I'm just too lazy (sorry to admit) to read manuals over again just for one case.

View 7 Replies


ADVERTISEMENT

Diving Into Regexp By Porting A Perl Script Over To Js That Uses Regexp To Compress Into A Bookmarklet Capable Format?

Aug 10, 2010

I'm finally diving into regexp by porting a perl script over to js that uses regexp to compress javascript into a bookmarklet capable format.I've successfully worked out 90% of the expressions but am troubled with a few, this one at the moment is odd:I want to remove the first line if it hasjavascript:So I thought str.replace(/^javascripts+:s+/, "") would be ok. I want javascript text, any space, colon, any space and new line. what I'm doing wrong.btw this is the original perl version

$src =~ s{^// ?javascript.+:.+
}{};

View 3 Replies View Related

RegExp.input, RegExp.leftContext, ...

Jan 19, 2007

I found this in felgall's page. I added script tag

<script type="text/javascript">

var re = /(t)he/g;
var mystring = "Over the moon.";
re.text(mystring);
alert(RegExp.input); // or RegExp.$_
alert(RegExp.leftContext); // or RegExp["$`"]
alert(RegExp.rightContext); // or RegExp["$'"]
alert(RegExp.lastMatch); // or RegExp["$&"]
alert(RegExp.lastParen); // or RegExp["$+"]
alert(re.source);

</script>

I don't see message box. Please tell me what I can do.

View 3 Replies View Related

How To Alter SpryValidationTextField.js

Oct 23, 2010

I have been struggling to find the right solution to validating a username in a form to make sure it is unique. I don't want to use Dreamweaver's validate username because I want the error to appear on the same page next to the form field as it does with the Spry Validation. I use Spry validation for all the fields but it doesn't check to make sure the username doesn't already exist. I was wondering if anyone knew the code I would need to add to SpryValidationTextField.js, SpryValidationTextField.css and the actual form page to make this happen.

View 6 Replies View Related

JQuery :: Alter Width Of One Div From Another?

Nov 7, 2011

I've got a div "main" that gets it's width changed via state chart. Now, in main I've got a div "item_title" that needs to change in respect to the width of "main" -90px because I have a fixed width 90px div also in "main". The code I have isn't sizing at all, like the width isn't being applied. In the css I don't have a width declared to the "item_title" to make sure nothing is interfering.

View 2 Replies View Related

Alter Page With OnClick()?

Mar 17, 2004

I need to display some addition html within a form when a checkbox is clicked. I know nothing about javascript but am pretty sure we can do it.

Here is what the code will look like if the box is NOT checked:

HTML Code:

<tr><td><input type="checkbox" name="name1" value="yes"> Check Me!</td><td>&nbsp;</td></tr>
However when the box is checked, I want some additional HTML to show, like this:

HTML Code:

<tr><td><input type="checkbox" name="name1" value="yes"> Check Me!</td><td><input type="text" value=""> Text Box Here!</td></tr>

Basically, when the checkbox is clicked, I want a text area to appear.

View 3 Replies View Related

Ajax :: Alter The Usage Of Function

Jan 16, 2009

I am using this code load a file from server to display in to a div.

Code JavaScript:
function getHTTPObject() {
var xhr = false;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
[Code]...

I want to use the same script but apply for a button, clicking the button, a file called from server will display in the div "ask_seller". Since button has no href attribute, I don't know how to name the file that going to be called(or I don't know what is the usage in this case)

View 4 Replies View Related

Alter Carousel Script For Next Previous?

Feb 11, 2009

I'm trying to slightly alter the script found here,[URL].What i want to do is make the carousel work on a Next/Previous feature versus a 1, 2, 3 method. I tried to do it myself but found i was was just going in circles and nothing was working.

Javascript

Code:

<script language="Javascript">
<!--
function slideFolio(col){

[code]....

View 5 Replies View Related

How To Alter Contents Of Popup Window

Jan 5, 2011

I have a popup window that appears, created by a 3rd party javascript. I have the handle to the window, it's called "pop". I'm not sure if that is the handle to the window actually.
typeof(pop) is "object"
typeof(pop.parentNode) is "undefined"
pop.document is undefined.
pop.body is undefined.
pop.focus() executes without errors but does nothing.
pop.moveBy() does not exist.
pop.location is the correct URL.
I want to do something like pop.innerHTML = "hello"; but that just makes an error. I don't want to change the URL of the popup window.

View 2 Replies View Related

Google Maps API - Alter The Size Of The Map?

Sep 8, 2009

i am debveloping a custom google map. how to alter the size of the map? i know it can be done because i did it for a college lesson but i've lost the code. also, is it possible to switch the default view to terrain as opposed to map?

View 1 Replies View Related

JQuery :: Alter Selected Menu Item?

Jun 5, 2009

I can access the drop-down value(s) the visitor has chosen by $("#ak option:selected").each(function () {... but now I want to force the drop-down list to be selected to a particular default value of my choosing ... how would I do this?I did try:

$("#ak option:selected").each(
function () {
$(this).text('-> Choose Accessory kind');

[code].....

View 1 Replies View Related

JQuery :: Alter The Height Of A Text Of Font?

Nov 22, 2011

how can I alter the height of a text of font?

View 5 Replies View Related

How To Alter This Code To Display Captions From Alt Tags

Jul 24, 2010

At the moment, the script creates a gallery with thumbnails from a list of images (from my basic understanding), and I want to add to it so the current code also picks up the text from the alt tag and displays that within a div box positioned absolutely elsewhere on the page, when the main image is displayed.Here is the javascript:

var gal = {
init : function() {
if (!document.getElementById || !document.createElement || !document.appendChild) return

[code]....

View 2 Replies View Related

Select Onchange Alter Another Field On Same Page?

Aug 4, 2010

I have a multiple fields on my page and wish to have a reusable javascript to update the previous box with the selction made.how would this be done

<form name="form1" method="post" action="">
<p>
<input type="textone" name="textfieldone" id="textfieldone">

[code]....

View 5 Replies View Related

Alter Text Size Working In IE But Not In FF Or Chrome

Apr 11, 2011

I've written a function to change the font, this is working in IE but not in FF or Chrome. No errors come up in Firebug. Once this is working in both browsers I will change the function to gradually increase the size of the font to make it look as if the font is growing. This is why I haven't just assigned a class to the text. URL of the site with the script is [URL]

[Code]..

View 2 Replies View Related

Alter A Variable On Mouseover In Multiple Browsers?

Dec 19, 2011

I've been trying to teach myself Javascript to figure out this problem, but I'm apparently not learning what I need to.The objective is this:I want to have a div appear below my mouse when mousing over different parts of my website.I know how to swap out the background images, I know how to change the div's sizes... It's just that I'm using one div, and in order to get this right, I need it to be positioned in different places under the mouse each time the image changes.I've got a cross-browser mouse-follow worked out, I just don't know how to edit the "divvx" and "divvy" variables when I mouse over the "boxtest" div. Here is the code I'm working on, maybe I'm just missing something obvious?

">
<html>
<head>

[code]....

View 5 Replies View Related

Jquery :: Alter Slideviewer Pro To Fade Instead Of Slide?

Mar 1, 2011

Does anyone know how I can alter JQuery slideviewer pro to fade instead of slide?

Here's the link to JQuery pro [code]...

View 1 Replies View Related

Target And Alter <iframe> Contents From Another Domain?

Aug 3, 2011

I want to add some classes to various bits on one of Worldpay's lovely payment iframes so I can make it look something like the site it's sat on.

This is the original principle I was using, which works when on a page with the same domain.

Code JavaScript:
$('#worldpay').load(function(){
$(this.contentDocument).find('body').html('Test: This frame was modified with js')
});

View 2 Replies View Related

JQuery :: Selectors And Chaining - Alter Text In DIV

Aug 29, 2010

I haven't used jquery for quite a while and I'm trying to simply alter out the text in a div with an ID of "test" but I'm running into trouble.
Code:
var mytest = $("#test");
alert(mytest);
I'm sure it's because I've selected the div as a whole, but I've tried selecting the first child with no success.

I suppose I should first chain in a "p" selector, then select the first item, but I'm not quite sure how to do it. What I think is my closest attempt is as follows:
Code:
var mytest = $("#test").("p")[0];
alert(mytest);

View 8 Replies View Related

JQuery :: Form Appears To Alter Returned Data?

Sep 30, 2010

I have a form which submits via ajaxForm so i can do a fancy image uploader:

$('#uploadForm').ajaxForm({
beforeSubmit: function() {
$('#uploadForm').find('.image-display').children('img').attr('src',

[code]....

View 3 Replies View Related

JQuery :: How To Alter Randomly Order Of TD Elements Of Table

Feb 20, 2011

I'm new in jQuery. I have to alter randomly the order of the td elements of a table. My initial idea is:
- Clone the original table (I can't modify it).
- Disorder randomly the elements of the cloned table.
- Show the cloned table.

The actual code is:
<html> <head>
<script src="[URL]"></script>
<script type="text/javascript">
$(document).ready(function(){
});
</script></head>
<body><script>
$(document).ready(function(){ .....

View 3 Replies View Related

JQuery :: Alter The Font Size Of A Dynamic Header?

Oct 26, 2009

We are working within a CMS and we have a dynamic text header that pulls into the top of the page. The problem is that there are certain titles that are too long and are breaking into other design elements. I'm thinking there should be a way to count the number of characters and then dynamically change the font-size of the header.

View 2 Replies View Related

Make A Menu That The User Can Alter The Display Of The Clock?

May 7, 2010

I got the functions i must use for a clock on a js file..i have to set up the variables for it on another js file though but those are easy enough.the question is...how do i make a Menu that the user can alter the display of the clock? eg: insted of 21:30 -->09:30 pm and so on...this thing s been buggin me for days now.

View 7 Replies View Related

Alter Code To Remove Scrollbar & Address Bar - Only Work In IE

Jan 7, 2006

It's been too long since I've used javascript! What do I need to add to this code in order to remove the scrollbar (or scrolling option) and the browsers' address & tool bars?

Code:
<script language=javascript>
<!--hide from old browsers
window.resizeTo(600,500);
window.opener = self;
//-->
</script>

The above code is in the <head> of the page that is being resized and stripped of scroll/address/tool bars. And will it only work in IE?

View 14 Replies View Related

Alter Css Style In Script Without Having To Use Onload Event Handler In Body Tag?

Nov 10, 2005

Is there a way to alter css style in javascript without having to use the onload event handler in the body tag?

View 5 Replies View Related

Alter The Area And Level Of Magnification Shown From The Original Image Onto The New Box?

Jun 2, 2011

The script below magnifies a small portion of a larger image in a separate box. Is there any way I can add to the code to alter the area and level of magnification shown from the original image onto the new box?

Code:
<script type="text/javascript">
function DoMagnify(sender, e)
{
var posx = 0;
var posy = 0;
if (!e) var e = window.event;
[Code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved