Spidermonkey Embedding: How Can I Set Class Properties?

Jul 23, 2005

I am embedding Spidermonkey in a C app. and I'm having trouble setting
class (not instance) property values. For example, I am setting up
the class as follows:

static JSBool constructor(JSContext *cx, JSObject *obj, uintN argc, jsval
*argv, jsval *rval)
{
printf("constructor argc = %d
", argc);
*rval = OBJECT_TO_JSVAL(obj);
return JS_TRUE;
}

main()
{
....
static JSClass my_class = {
"MyClass", JSCLASS_HAS_PRIVATE,
JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS _PropertyStub,
JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_ FinalizeStub
};
static JSPropertySpec class_props[] = {
{"Prop1", 0, JSPROP_ENUMERATE},
{0}
};
JSObject *proto;

proto = JS_InitClass(cx, JS_GetGlobalObject(cx), 0, &my_class,
constructor, 1, NULL, NULL, class_props, NULL);

The above code correctly (verified through a JavaScript program). creates a new class with the Prop1 class property.

The following code correctly adds an _instance_ property:

jsval val = INT_TO_JSVAL(42);
JS_SetProperty(cx, proto, "MyProp2", &val);

After three days I still can't figure out how to set the value of the class
property, or, for that matter, create a new class property with a particular value. I am looking to do something like this:

jsval val = INT_TO_JSVAL(88);
JS_SetProperty(cx, ???, "Prop1", &val);

View 3 Replies


ADVERTISEMENT

Changing Class Properties

Jul 20, 2005

I have a number of elements of "some-class".

I'd like to change the styles of some-class:

from

..some-class{color: red; display: block}

to

..some-class{color: red; display: none}

How do I do that?

View 6 Replies View Related

Change The Properties Of A Css Class?

Apr 11, 2010

I'm trying to make a webpage where you can change the colour of various elements within the page, which has numerous div classes in the css and numerous divs all with different names. What I'm trying to work out and can't find anywhere is can you change the properties of a css class using javascript, and if so, how?

View 2 Replies View Related

Change The Display Properties Of A Class

Jul 28, 2006

can u change the display properties of elements in a certain class?

View 1 Replies View Related

Change CSS Properties Of Each New Instance Of Class?

Dec 14, 2009

I need to change the background-image (or possibly background-position) property of each new instance of a div with a particular class. I will have a set of images to choose from, or could create a sprite with all of the images.

Example:

Code:

<div class="desc">content</div> **needs background-image: url(pic1.jpg)
<div class="desc">content</div> **needs background-image: url(pic2.jpg)
...
etc.

The page code is dynamically generated from our CMS, so can't change the HTML.

View 3 Replies View Related

JQuery :: Brain Fade Add Css Properties To A Class?

May 13, 2010

ie. the equivalent of typing them in a style sheet, but doing it dynamically?

View 6 Replies View Related

JQuery :: Get Class Properties In Event Handler (in OOP)

Feb 3, 2011

i'm looking for the best way to use global properties that defined at class level insid event handler functions.

for example :
function MyClass() {
this.v1 = "hello";
this.v2 = {name: 'joe', age:'30'};
this.link1 = $("<a/>", {id: "link1"});

[Code].....

actually, in link1Handler 'this' returns to link1 not to main class. so how to get class properties or functions inside the private functions of the same class?

View 2 Replies View Related

Difference Between Class And Name Properties In HTML, As Applied To JavaScript

Dec 17, 2001

how the class attribute works in CSS: I can specify that every attribute with class="foo" be italicized with: .foo {font-style: italic;}

What if I want to do the same sort of thing in Javascript? Is there something built-in like document.GetElementsbyClass("foo").style = "italic" (I'm just making this code up of the top of my head, I don't know how javascript works.)

It seems to me that with JavaScript you're supposed to use the name="" attribute instead of class="". Why the diference?

I looked at webmonkey that had an article about this, but their writing style is simply confusing and I can't make heads or tails of their articles.

View 1 Replies View Related

JavaScript - SpiderMonkey And QNX 4

Jul 23, 2005

Does anyone know of a port of the SpiderMonkey JavaScript engine to QNX 4?

View 1 Replies View Related

SpiderMonkey Standalone Commandline & Stdio

Jul 23, 2005

1) Running a standalone script with SpiderMonkey on Linux
js -f scriptfile.js scriptarg

How can I get the value of scriptarg from within the JavaScript
scriptfile?


2) Running a standalone script with SpiderMonkey on Linux

How can I do formated printing to stdout?

(I see that /js/src/perfect.js uses print() is there an equivalent for
printing formated reals?)


3) Running a standalone script with SpiderMonkey on Linux

How can I read from stdin?

View 3 Replies View Related

Object Properties With Array Syntax - Add Extra Properties To Html Elements

Nov 13, 2009

how to add extra properties to html elements as I was storing data in html attributes. After looking at some others code including Raphael and this addEvent code. [URL] They seem to treat objects just like an array. obj[property] = value; This would have been extremely helpful to know previously as I have needed to be able to include variables in property names - but have resorted to making the whole thing a string and calling exec() on it.

View 2 Replies View Related

Embedding Movies

Jul 23, 2005

Here is another one - I am just soaking up all these new learnings!

I have the following piece of html

<IMG SRC="test.gif" WIDTH="320" HEIGHT="256" ALT="movie placeholder">
<BR>
<A HREF="test.mov">Interiors</A> |
<A HREF="althorpe1.mov">Interiors</A> |
<A HREF="althorpe2.mov">Exteriors</A>

I want to implement a little JavaScript that allows the picture to be
swapped for a virtual tour, a QuickTime mov file. Here is the syntax for
the test.mov file that should replace the test.gif

<EMBED SRC="test.mov" WIDTH="320" HEIGHT="256" BGCOLOR="E8E8E8" CACHE="true"
HOTSPOT66="NewMovie.mov" CONTROLLER="true"></EMBED>

Now you probably say .... listen dude, check out the 101 postings on
swapping images..... Well, just to make it a little more complicated, I want
to add the HOTSPOT functionality. When you make the QuickTime movie
(virtual tour - aka 360 view), you can identify hot spots. These are
basically areas that the user can click on to get the next virtual tour /
movie. Now, in test.mov, there is a hotspot66, when you click on it,you are
supposed to link through to NewMovie.html (which would contain
NewMovie.mov), but I want the same file to remain on the screen and
NewMovie.mov to be placed into the image area.

Seems that we have moved (prematurely of course) to JavaScript 102....

View 4 Replies View Related

Embedding Wmv In Tinyslideshow?

Dec 14, 2009

I am using the tinyslideshow and need to be able to embed a wmv file into it. It needs to open within the slideshow as the thumbnail loads and when clicked just as the image does. I have not been able to figure this out or know if it is possible

View 3 Replies View Related

Embedding IM In Web Page For Support

Feb 10, 2006

I am looking for a way to embed an IM window into a web page, so that
users can easily send an IM to a support person. I am looking for
something free and easily implemented, that doesn't require any client
download on the user's system. And supports one of the major IM
services like Gtalk, AIM, YIM, ICQ, etc.

Basically I want to provide very very simple answering of questions, so
along the lines of LivePerson without the cost and extra features.

View 2 Replies View Related

Embedding The Youtube In Webpage

Jun 21, 2010

embedding the youtube in my webpage by javascript.How the same can be done by java as there lot of API are given did any one done by using that tell me the step by step procedure for the same.

View 1 Replies View Related

Embedding All Youtube Channel?

Nov 23, 2011

I have used this tool in order to display all my youtube videos.[URL]When you go over the thumbnail of one of the videos, you can see the title of each video (the title of the specific video in youtube).I want this title to be displayed before the thumbnail (above it).There are 4 JS files, 1 CSS and a small html code (all on the link provided).

View 1 Replies View Related

Embedding Video In Html

Feb 9, 2011

The webpage I have created has embedded video (FLV). It was created in Camtasia from a PowerPoint presentation. Camastia has media controller with a srub line, however the person I designed this for want to be able to advance to the slide in the movie with a forward or back buttom.

View 5 Replies View Related

Embedding Content Via Javascript

Aug 2, 2007

I am trying to embed content via javascript using the following code:

<script type="text/javascript" src="http://example.com/script.php"></script>

When I place the script.php in other servers it works fine (content can be viewed) except with one server, it doesn't return anything (just blank screen). What could be the possible problem, is it a hotlinking issue or something else?

View 8 Replies View Related

Embedding One Page Inside Of Another?

Apr 22, 2010

I'm trying to embed a whole other external html document inside another using <script type="text/javascript" src="FILENAME.js" />.I've been led to believe that it is possible to do so, as long as I rename my html document with the .js extention.The first page loads, but the page being referenced won't load - am I trying to do the impossible?

View 4 Replies View Related

JQuery :: Using Embedding Youtube Videos?

Jun 23, 2009

I've been trying to add embedded youtube videos to the carousel but so far without success. The videos are all over the screen, even when I wrap them in div. Has anyone ever done this and could help me?

View 2 Replies View Related

Dynamically Embedding Youtube Video?

Oct 30, 2011

how to Dynamically embedding youtube video?

View 1 Replies View Related

XML Flash Embedding Behind Other Content (Lightbox)

Jan 18, 2010

How to embed this flash so it will stay behind other content, e.g. a lightbox?

<td align="left" id="container" valign="middle" z-index="0"><!-- see notes for files included -->
<a href="[URL]">Get the Flash Player to see this rotator.</a>
<script type="text/javascript" src="my/path/to/file.js"></script>
<object><script type="text/javascript">
var s1 = new SWFObject("my/path/to/flash.swf","rotator","415","120","7");
s1.addParam("allowfullscreen","false");
s1.addVariable("file","my/path/to/file.xml");
s1.addVariable("width","415");
s1.addVariable("height","120");
s1.write("container","embed");
</script></object>
</td>

I am fine with embedding full flash but with this XML/javascript flash, I am truly lost.

View 2 Replies View Related

Embedding In Xslt And Accessing Variables

Oct 26, 2009

I need to embed a small piece of javascript inside xslt. Basically I need to generate a hyperlink dynamically. I need to access xslt variables and use it in the javascript to create the hyperlink. Then in the xslt, I need to access the javascript variable containing the dynamically created hyperlink.

Here's the pseudo code I started with:

The above url then should look like this:

View 3 Replies View Related

Embedding SWF Object - Preventing My Video From Showing In IE8

Jun 18, 2010

Issue that's preventing my video from showing in IE8.

It play's on all other IE versions...and plays fine in Firefox & Chrome.

View 1 Replies View Related

Embedding Flash With Swfobject / Making Sure Swf Exists On Server

Aug 25, 2006

I am working on a project that is using load balanced servers.. all the media that is referenced in the flash is referencing that server. but for some reason on our wireless at work we can't access that server... so I want to check to see if the swf file is existant on the server before writing out what swf to embed.. so if it is there, meaning we're not on wireless.. it will ebmed that one.. otherwise embed a different swf that will use that server's local copy of the site..

View 1 Replies View Related

Embedding And Control Windows Media Player With HTML But Cannot Run Script Through A Different Page

Nov 29, 2009

I'm doing embedding Windows Media Player with the HTML but I can not run the script through a different page. The following script that I made: file : player.html

<html>
<OBJECT id="VIDEO" width="640" height="480"
style="position:relatif; left:0;top:0;"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">
<PARAM NAME="URL" VALUE="file_name.mpg">
<PARAM NAME="SendPlayStateChangeEvents" VALUE="true">
[Code]...

View 3 Replies View Related







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