JQuery :: SVG Plugin Retrieving X And Y Values Of Text Object

Jan 16, 2011

I am using the SVG plugin. I have a simple test and I am unable to retrieve the x and y values of a text object.
$('#objID1', svg.root()).attr('x')

This returns as empty. Where as:
$('#objID1', svg.root()).attr('fill')
successfully returns the fill value.

HTML code:
<html xmlns="[URL]">
<head><title>SVG test</title>
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.7.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.svg.js"></script>
<script type="text/javascript" src="js/jquery.svgdom.js"></script>
<script type="text/javascript" src="js/jquery.svganim.js"></script>
<script type="text/javascript" src="js/test2.js"></script>
<style>
#svgCanvas {
width: 200px;
height: 200px;
border: 1px solid #ff0000;
}
#svgAtts {
width: 200px;
height: 200px;
border: 1px solid #ff0000;
}
</style></head><body>
<div id="svgCanvas"></div>
<div id="svgAtts"></div>
</body>
</html>

Javascript code test2.js:
$(function() {
$('#svgCanvas').svg({onLoad: function(svg) {
//code
}}); });
$(function() {
var svg = $('#svgCanvas').svg('get');
var obj = svg.text(50,50,'Some Text',{id: "objID1", fill: "#FF0000", fontFamily: "Arial", fontSize: "24"});});
$(function() {
var svg = $('#svgCanvas').svg('get');
var string = 'fill = ' + $('#objID1', svg.root()).attr('fill') + '<br />';
var string = string + 'font family = ' + $('#objID1', svg.root()).attr('font-family') + '<br />';
var string = string + 'font size = ' + $('#objID1', svg.root()).attr('font-size') + '<br />';
var string = string + 'x = ' + $('#objID1', svg.root()).attr('x') + '<br />';
var string = string + 'y = ' + $('#objID1', svg.root()).attr('y');
$('#svgAtts').html(string);
});

View 2 Replies


ADVERTISEMENT

Retrieving Values From Arrays?

Sep 13, 2010

i need some help with an assignment. the program needs to display a list of flights from options selected from drop down menus. i have written the code to display all flights, now i need to write the code to include the options such as destination and airline. here is the whole of the code.

<HTML>
<HEAD>
<TITLE>Stanwick Imaginary Airport - flight information</TITLE>

[code]....

View 2 Replies View Related

Retrieving Values From Select Box?

Mar 30, 2011

I'm trying to figure out what I'm doing wrong here. I have a select control and I'm trying to determine what index or value was selected and I can't seem to get it to work right. I'm sure it's something simple but I'm new at this.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[code]....

View 5 Replies View Related

Retrieving Form Values In Javascript

Sep 29, 2006

I am trying to create a form for authorised users to upload photos to
an image gallery. I'm attempting to perform simple validation of the
fields by ensuring the fields aren't empty and that the extensions are
right. However, I can't seem to access the actual values of the fields
to start with.

If I simplify my problem, can anyone tell me why this would work in a
Javascript alert:

alert(document.form.Photo1.value);
//This outputs 'D:/images/x.jpg'

but this won't:

var photonumber = "Photo" + 1;
alert(document.form.photonumber.value);
// I get "undefined"

The reason I'm doing this is because I'm looping through a finite set
of images and need to check each one is valid.

Is it because I'm not initialising the "photonumber" string correctly?

View 4 Replies View Related

CPU 100% On A Loop While Retrieving Form Values

Jul 20, 2005

I have a form with a lot's of number of Text and Hidden Fields. I just do a simple loop to get each value for each attribute. I have about more than 2000.

if i do something simple like :

for (var i=0; i<2000; i++)
aValue = i+10;

it runs well. But if i do something like
for (var i=0; i<2000; i++)
aValue = document.myForm.elements[i].value;

it gives me 100% CPU for a long time before i submit the form.

View 3 Replies View Related

Retrieving Values From Options With If Statement?

Jul 20, 2009

I an designing a website and the user need to select from option of three values. Each option selected have a numerical value. On selection the numerical value attached to the selection will be multiplied by the another value in an input box to get a final value.

View 4 Replies View Related

Selectively Retrieving Values From An Array?

Dec 2, 2010

I am trying to create a script to randomly assign recipients to givers for a Secret Santa.he participants are placed into groups. A giver cannot be assigned a recipient with whom he is grouped. I want to return all of the assignments in a table. I have made the following script. When I run it, it seems to get stuck in a loop. Any ideas why this might be? If you have any questions about how I want this thing to run, feel free to ask.

<html>
<head>
<script type="text/javascript">

[code]....

View 19 Replies View Related

Retrieving Values From Html Tables?

Nov 24, 2009

I have populated data in html table. Now I have to retrieve the value from this table, row-wise. How can i do this.

View 1 Replies View Related

GetElementById Not Retrieving Values From ASP Textbox?

Sep 13, 2007

I have been trying to use

<script language="javascript" type="text/javascript">
function check_length()
{
var x = document.getElementById("tbDescription").value;
alert(x);

[Code].....

but get an object required error in IE and ocument.getElementById("tbDescription") has no properties in FireFox. I have tried using the single, double quotes, and nothing around the tbDescription in the javascript function, but none of the 3 helps.

View 9 Replies View Related

Retrieving Values From Html Form?

Aug 18, 2010

So I'm a novice coder and have been trying to piece together a (seemingly) simple function. I want the user to be able to enter in a certain amount of time into a form, and then when they click submit, it opens a new page and closes after that amount of time.There is a very simple form on the first page that accepts input and looks like so:

<form action="onbreak.php" target="_blank" method="POST"><p class="fillable">I would like to view <input type="text" name="url" id="url" value="" size="30"/> for <input type="text" name="timeinput" id="timeinput" value="" size="3"/> minute(s). <input type="submit" value="Break Me!"/></p></form>

[code]....

View 5 Replies View Related

Retrieving The Dynamic Created Form Values?

Nov 28, 2010

HTML Code:
function makeForm(name) {
mypara=document.getElementById("paraID");
myform=document.createElement("form");
myselect = document.createElement("input");

[Code].....

I am creating a form dynamically using javascript.The form is created successfully. After creating the form before submitting the form i would like to make some check points before submission.so while creating the form i am adding the event on submit=call function for validation .THe function is called successfully but i am unable to retreive the form values in the validation script

View 1 Replies View Related

JQuery :: Retrieving Text Inside A <b> Tag?

Feb 7, 2010

how Id be able to retrieve the text "Text I want to retrieve".

[Code]...

View 1 Replies View Related

Retrieving RSS Data Using XMLHttpRequest Object

May 9, 2010

I am having trouble populating elements from the following Yahoo RSS feed: [URL] I need to show the current weather conditions when a button is clicked. Here is what I have so far.

[Code].....

I need to populate the <h1> and two <p> elements. I know that the copyWeatherData() and getWeatherData() functions are not coded properly.

View 2 Replies View Related

Retrieving Info From An Object Dynamically

Dec 31, 2010

I trying to retive info from a object but am having some problems, I'm not that familliar with Javascript but got background in other languages.

[Code]....

View 1 Replies View Related

Retrieving Values In Table Format From An Access Database?

Oct 21, 2011

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

[code]....

View 1 Replies View Related

Retrieving Certain Text From A Webpage

Dec 27, 2010

For a personal project, I want to see if I can make a Greasemonkey userscript (or eventually a Firefox add-on) to list how far a certain ad on Craigslist is from where the user is (by the city listed beside the ad). My question is really just looking for ideas on how I can parse out the city's from the webpage text (with javascript or some other language?). Not even sure if this is possible.

The city's or ads aren't their own div elements or anything (nothing can ever be so simple) - but the city's listed are formatted by <font size="-1"></font>, and each ad is in it's own paragraph tag.. maybe I can use that somehow?

View 4 Replies View Related

Retrieving The Value Of A Readonly Text Field

Jul 20, 2005

I'm not sure why I'm having problems with this but if I try to retrieve the
value of a readonly text form I get back that the object is undefined.

The reason the text is readonly is because it's a date which I set via a
calendar javascript program (associated with a button) only so the user
can't put something silly in requiring validation.

The form send the data correctly when submitted it just doesn't seem to be
able to be read.

View 7 Replies View Related

Retrieving JSON Array From Text File?

Feb 26, 2011

I am fairly new to javascript and I am wondering how I would load a text file that has a JSON formatted array stored in it?I can pass the array directly to the page via php though I want to be able to store the data and save on calls to the database and of course load the data dynamically to the page.

View 1 Replies View Related

Literal Notation: Change Values Of A New Object Without Changing The Parent-object?

Oct 9, 2010

I have the following code:

A = {
"value": "a",
};
B = A ;
B.value = "b";
alert (A.value); // => b

I expected A.value to be "a". how can I change values of a new object, without changing the parent-object?

View 6 Replies View Related

JQuery :: Returning Object From Plugin?

Aug 24, 2009

Basically what I'm trying to do is write a plug in which connects to a sharepoint web service, traverse the results of the xml document that is returned by the web service for certain elements, and then return a collection of xml elements which I can use in another function on the page that is calling the plugin.My code looks like this:Main Page

<script type="text/javascript">
$(document).ready(function() {
var listItems = $.sharepoint();

[code]....

View 1 Replies View Related

JQuery :: Plugin Passing Wrapper Object As This

Feb 11, 2010

I created a quick plugin. You can see it at http: [URL]. It has a strange feature. This plug-in treats the jQuery wrapper object as a group, and passes the whole wrapper in as the context object (the "this") for the functions supplied. Generally, when functions are supplied as parameters, either the context is irrelevant, or each DOM element in the jQuery wrapper is passed. But I don't do that. My plug-in keeps a reference to the jQuery wrapper and calls the functions in that context. This is necessary, because the whole idea is to act on a number of elements as a group -- in this case by fading in and out all members of the group when any individual one is hovered -- but I don't recall seeing this done elsewhere in the jQuery ecosphere.

View 2 Replies View Related

JQuery :: Validate Plugin - Trim Values Before Form Validation

May 3, 2011

is there any way to trim the filed value before using jquery validate plugin [URL]../Plugins/Validation/Validator.

View 1 Replies View Related

JQuery :: Apply Plugin To Dynamically Created Object?

Apr 15, 2011

I'm trying to update a plugin i downloaded. What i'm trying to do, is make it able to work with dinamically created objects. I'm using the live function to assing javascript events, but i need to know how to assing a plugin dynamically. This is what i have right now:

$("#txtinstruments").AutoComplete("query"); What this does is apply the AutoComplete plugin, to all the objects with id txtInstruments that are already created but, i create more objects with that id on the fly, and i need to assign the plugin to them.

View 4 Replies View Related

JQuery :: GMap Plugin - Modifying A JSON Object?

Oct 9, 2010

I've started using the gMap plugin [URL] in my site

I have a div, with id "map" in my code and I am creating the map with the following code, passing in a JSON object for config:

$(function() {
$("#map").gMap({
latitude: 54.7,
longitude: -4,

[Code]....

I want to programatically re-center the map and add markers elsewhere in my code, but don't know how to access this JSON object to modify it.

The way I'm currently doing this is to call gMap again with some new configuration, but I don't think this is right as I think it's re-creating the map all over again.

View 2 Replies View Related

JQuery :: Hash Values For Cycle Plugin With Multiple Slideshows On One Page

Jul 14, 2011

I'm a javascript rookie trying to figure out a way to get bookmarkable URLS for the images on a single page with multiple slideshows. I must admit I don't really understand the first part of the code on the Cycle demo page for this, which only works for a page with one slideshow:

While I'm shopping for a little guidance, it would also be really cool if the hash tags were semantic somehow with respect to each slideshow e.g.:

[url]
[url]
[url]

View 2 Replies View Related

Jquery :: Get All Attributes Key / Values Form Object

Jun 16, 2009

Let's say we have:

<div id="id2" color="brown" location="earth" iq="low"></div>

Now, we know "id". How to get all other attributes (key and values) if we do not know them ?

View 5 Replies View Related







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