Setting An Image Url (without Extension) As A Class Name

May 18, 2006

This probably isn't that difficult, but it's a bit out of my league.

What I'm looking to do is find an image name, I think using document.images [], then strip the extension, then use the DOM to set the result as the class name of a div.

Something like this:

document.getElementById("thediv").className = [image src without extension];

The image that I'm looking to identify will change from 01.gif to 40.gif, and is served by a lame proprietary server-side tool. I can't control what it is at any time, but it will always be from 01.gif to 40.gif.

There will be corresponding styles in my stylesheet that would give me the effect of <div id="thediv" class="01"> (except set by the DOM) after the script has done its magic.

View 11 Replies


ADVERTISEMENT

Setting A Class Onload

Sep 19, 2007

I'm using this script/*<![CDATA[*/

function mOver(obj){
if (obj.id == "people") { document.getElementById(obj.id).className="mOverTwoLine" }
else {document.getElementById(obj.id).className="mOver" }
}

function mOut(obj){
document.getElementById(obj.id).className="default"
}

function rightNavHere(obj) {
if (obj == "people") { document.getElementById(obj).className="mDownTwoLine" }
else {document.getElementById(obj).className="mDown" }
}

/*]]>*/
to manage a rollover, and I am trying to set the class of a particular link onload via rightNavHere('about'); but it doesn't seem to be working.

View 10 Replies View Related

JQuery :: Setting Class On Td With Attr?

Mar 16, 2011

jquery and am trying to set the class value on a td cell. It looks as though it is crashing on setting the attr value. This is effectively what I am trying to do.

// get my row
var row = $("#tableID").find("tr:eq(0)");
// get the cells in this row

[code]....

View 1 Replies View Related

JQuery :: Setting CSS Class To Drop Down

Sep 14, 2010

In my page i have a dropdown 'Type' with id 'idType', which needs to be set to focus when the page loads (depending on whether it has a value or not..)The css is not getting applied to the dropdown when it is in focus. Please can you help me to find a solution since i am new to jquery

View 3 Replies View Related

JQuery :: Dynamically Adding Table Row And Setting Class?

Sep 5, 2010

I have a table with onw row and one column.I have set class for column also written function for click event for class.Now added table row dynamically and set same class.But click event works only for existing row not for newly added row.

View 1 Replies View Related

Setting Parent Class Variable From Inside Function?

Sep 8, 2009

Ok...so here is what I have:

function myClass() {
this.checkLogin = function(name,pwd) {
if(name.length > 0 && pwd.length > 0) {[code]....

Everything works above. The first alert shows that this.status was set to 'error'. However, if I call myClass.getStatus(), I get undefined. How can I get the parseData function to set the variables in the parent function?

View 1 Replies View Related

JQuery :: Tabs - Setting List To Display Depending On Class Of Body Tag?

Nov 6, 2011

I'm working on a site where we display two lists of boats, sail or power via the organic tabs plugin. Now, our client wants us to show one list type by default depending on the class of the body tag - for example, if the user was on a sailing boat page, the body would have a class of 'sailPage' and therefore the list that would be shown by default would be the 'sail list' - and vice versa for the power (although be default this one shows first anyways as it is the first 'panel' in the HTML') In my admittedly rather clumsy way, I've written the following jQuery function which does seem to work (well, the first half) - however when the user clicks back on to the 'power' tab whilst on page with a class of 'sail', the power list doesn't display. There also seems to be a problem in IE7 where the content of the lists will not display until you select the other tab first, and then select the second tab again?

<div
id
=
"sailOrPower"
>

[Code].....

View 3 Replies View Related

JQuery :: Setting Background Image To Another Div's Dynamically Generated Image?

May 12, 2010

I have a div set up like this

<div id='y' style='background-image: url(./randomcolor.php?ibase=
<?
php echo $entity
->

[code]....

I am having an issue with setting the background-image of a another div #x to the background image of #y.Correct me if I am wrong but I think you would do this in a simple case by saying

$
(
'#x'
).

[code]....

So when it does it, it is getting the URL of the generator (I logged it. what is actually being passed is [URL] This would require a server call to generate a new image, In this particular application, even if it wasn't exactly the image y had it would be acceptable. But it's not doing it. It is not getting any image at all. Am I doing something wrong, i.e. is it supposed to just work? I would think not, since the page has already been rendered. This is almost an ajax situation but I don't know how to do it for an image. I don't really want to generate a new image anyway, I'd be very happy to get the one that's already there. How would I access the actual image already attached to y and not do another server call?

View 2 Replies View Related

JQuery :: Setting 'class' Attribute In Bulk Attribute Syntax Without Quotes Breaks IE/Opera?

Jan 20, 2010

i have found a possible bug in 1.4 but it's only in Internet Explorer 7 & 8.The following code does not work and completely ruins every peice of jquery on the page (that means everything inside $(document).ready and anyting else...

$("<div/>",{
id: 'tooltip-'+rand,
class: 'dock-tooltip',

[code]....

I cant see any syntax errors - i pulled the example from the 1.4 site. There is no trailing commas in the object notation and i really cant see any reason it would work in firefox and not IEx and more to the point not only not work in IEx but break any other jquery in the entire page....

View 5 Replies View Related

Setting The Src Of An Image To Nothing

Nov 1, 2005

How do you set the src of an image to nothing?

I have a form that displays an icon beside a field if it contains a negative value and want to remove the icon when the value is no longer negative.

I was doing note_icon.src = '' but this produces "Directory Index Forbidden by Rule" messages in the server error log because the empty string is being interpreted as meaning the directory where the script is running on the server.

View 1 Replies View Related

Setting An Image Width - Change An Image On A Page Without Reloading The Page

Jan 6, 2010

I'm using Javascript to change an image on a page without reloading the page. The problem is that my images are various widths (but identical heights), yet each image I change it to uses the width of the first image.

[Code]...

View 4 Replies View Related

Setting Image Source From The Head

Oct 5, 2009

I'm trying to set up an image's source from a function within the document's head, but to no avail. The code is something like this:

<head>
.....js code.....
function updatePieChart()
{
document.pie_chart.src = "piechart.php?p1&p2"; // php-generated image, with parameters
}
[Code]...

View 2 Replies View Related

Setting A Background Image To Print?

Aug 10, 2011

I have a web page that has a background image behind a signup form. I need the background image to print.

Here's how the code starts:

<table width="750" height="756" background="http:trustdale.com/wp-content/uploads/2011/08_Images/RBMCertificate.png" cellpadding="65" cellspacing="100">

View 1 Replies View Related

Jscript Image Gallery - Setting The Thumbnails Up

Jul 31, 2010

i installed jondesigns smooth gallery from [URL] All installed fine, minus one problem with setting the thumbnails up. It asks for this to be entered im just not sure where that code should go: useThumbGenerator: true also it asks for a cache folder to be writeable does that just go anywhere or? Heres my version here: [URL]

View 3 Replies View Related

JQuery :: Setting Image To Link To Itself And Open In Colorbox

Jul 20, 2011

I have an image that has been resized via CSS to show as 100x100px on an HTML page. When clicked, I want to open the image in a colorbox - so the user can see the non resized/squashed version as it will normally appear. I've worked out how to set the path of the href to itself (so this doesn't have to be changed every time) (see below), although not sure how to get the colorbox part working - I tried changing 'each' to 'colorbox' - as per how you would normally assign the colorbox, and it opens, it just doesn't load the image in it.

<div class="logoImage"><img src="../tym_img_shared/background-2.jpg" alt="Your company logo" /></div>
$(document).ready(function(){
$('div.logoImage img').each(function(){
var $this = $(this);
$this.wrap('<a href="' + $this.attr('src') + '"></a>');
});
});

Thinking about it, perhaps it would be easier to also set the 're' attribute of the link whist setting the source?
$(document).ready(function(){
$('div.logoImage img').each(function(){
var $this = $(this);
$this.wrap('<a rel="gallery" href="' + $this.attr('src') + '"></a>');
});
});
Doesn't work for some reason - but it does if I hardcode the URL and rel?

View 6 Replies View Related

JQuery :: Setting Height Of Popup Multiple Times, Background Image Still Shows In IE6?

Sep 1, 2009

I have a hidden popup that I populate with content and it dynamically expands to the size of the content. I then show the popup. When a user clicks on another link, it populates the popup with longer or shorter content. When the content is SHORTER, it seems to show the background image that I'm using expanding to the height of the previous size of the popup. I've tried setting the height manually with JS, no luck. This only happens on IE6.

View 1 Replies View Related

JQuery :: Click Swap Image Gallery - Turn Off The "hover" Class And The "show" Class Of The Others When You Click One?

Mar 23, 2011

This is what I'm trying to do: I want a simple image container to swap the image inside it by clicking the nav buttons on the right like 1, 2, 3.Here's my code:

HTML
Code HTML4Strict:
<div id="item1">
<div class="img-container shadow" style="background-image:url(images/gallery/tcg1.jpg)">[code].....

My jQuery code is not right. I want it to turn off the "hover" class and the "show" class of the others when you click one. I think I need some kind of if..else? how to write it? I have a bg image set on the container div so there's an initial image to view.I also need multiple of these on the same page!

View 1 Replies View Related

JQuery :: How To Give Image ID Or Class

Aug 17, 2010

I'm working on this page: Work in progress
I'm using this tutorial:
On my work in progress link, I have two players on one page that just replace each other. The problem is with the left and right navigation arrows on the picture viewer. When you switch to the video player (grey video button on below player) the navigation arrows remain, I want them to only appear on the picture viewer. I think I can do this using z-index in css but need to give the two arrows some id's so I can select them. I can't seem to work it out in jquery! How to give the two images id's (see code below) or even better, make them only appear when you are on the picture viewer.

//** Step Carousel Viewer- (c) Dynamic Drive DHTML code library: [URL]
//** Script Download/ [URL]
//** Usage Terms: [URL]
//** Current version 1.9 (July 28th, 10'): See [URL] for details

jQuery.noConflict()
var stepcarousel={
ajaxloadingmsg: '<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>', //customize HTML to show while fetching Ajax content
defaultbuttonsfade: 0.4, //Fade degree for disabled nav buttons (0=completely transparent, 1=completely opaque)
configholder: {}, .....

View 11 Replies View Related

Make 'new Image' Class Clickable?

Aug 30, 2010

How do I make a "new Image()" class clickable? I found out how to move it around with the keys, but is there some way to make this image clickable?I don't want clickable images as an HTML element. It has to be inside my JavaScript canvas.

View 2 Replies View Related

JQuery :: Using Compound Css Selectors To Toggle A Class Of An Image?

Mar 12, 2011

I'm creating a hover effect like this. I have a 6 columns of images. There are 2 images per column stacked on top of each other. Like so:

X X X X X X
X X X X X X

The top row of X's I want to start out as invisible. When you hover over the bottom row of images, the top row fade's in (by toggling the css code opacity from 0 to 100), and then when you mouseover, it fades back out to 0. I'm having trouble setting this up. Here's my HTML:

<div class="carbox" id="box1"><img src="img/impreza2.jpg" class="imgtophidden"/><img src="img/impreza.jpg" class="imgbot" /></div>
<div class="carbox" id="box2"><img src="img/wrx.jpg" class="imgtophidden"/><img src="img/wrx.jpg" class="imgbot" /></div>
<div class="carbox" id="box3"><img src="img/legacy2.jpg" class="imgtophidden"/><img src="img/legacy.jpg" class="imgbot" /></div>

[code]....

View 1 Replies View Related

Files With The .js Extension

Jul 20, 2005

I have recently bought the book: JavaScript & DHTML Cookbook. As I
opened the .js files with note pad, I asked myself why was the code
formated in such a way. The code looks as if it had been produced by
some kind of programs instead of a person. I also noticed a lot of
little squared zeros; what are those all about?

I have also noticed code formated in a similar way, when viewing some
of the source code of the web pages on the MSN web site. If someone
knows anything about this machine-like formating, I would love to hear
from you.

View 3 Replies View Related

Getting Name Of File WITHOUT Extension?

Jun 3, 2009

I've been doing some research on url names. The problem is, I need this code to return like say "index.php", it would return "index". But idk where I went wrong..

The code:
<script>
var sPage;
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\') + 1);

[Code]...

View 28 Replies View Related

Run Program - .js Extension ?

May 5, 2011

How to run ajavascrpt prgram...i.e .js extension........

Is it to be run in dreamweaver...or any other simple way is there......or it is to be embedded in html code...and then run as .html extension...

View 1 Replies View Related

File Extension?

Jan 1, 2007

I allow people to upload images onto my web server. I want to verify each image is less than 50Kb and is an image type, this is what I came up with Verifying the files extension Code:

View 7 Replies View Related

Little JS Help For Firefox Extension

Nov 8, 2007

This might be more of a firefox extension development question but it has to do with JS so i'll ask here in hopes of finding someone with experience in this.

My extension requires the URL of the image that was right clicked. Meaning I have added a new option in the right-click menu when an image is right-clicked that calls a function in my JS file


JavaScript Code:
imgSrc ();

This function requires the URL of the image that was right clicked to be passed into it. Does anyone know how I would do that?

View 2 Replies View Related

JQuery :: Select Class Which Is In The Same Class Of Class, On Which Clicked?

Jun 3, 2010

My code: [URL]... When I click on UpraviƄ in class edit I need add some HTML code to begin and to end of class entry how to I can select class entry in the same class post on which I clicked?

View 1 Replies View Related







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